Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cake
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
template admin
cake
Commits
c349b15f
Commit
c349b15f
authored
Mar 15, 2022
by
李帅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化完成
parent
05f8ab0c
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
1016 additions
and
2338 deletions
+1016
-2338
cake.meta
assets/cake.meta
+3
-3
cake.fire
assets/cake/scene/cake.fire
+432
-298
cake.ts
assets/cake/scene/cake.ts
+227
-154
cocos_generator.fire
assets/cake/scene/cocos_generator.fire
+0
-1303
cocos_generator.fire.meta
assets/cake/scene/cocos_generator.fire.meta
+0
-7
cocos_generator.ts
assets/cake/scene/cocos_generator.ts
+0
-195
cocos_generator.ts.meta
assets/cake/scene/cocos_generator.ts.meta
+0
-9
test_nice_try.png.meta
assets/cake/textures/切图/test_nice_try.png.meta
+2
-2
buildCocos.js
bin/buildCocos.js
+352
-367
No files found.
assets/cake.meta
View file @
c349b15f
{
"ver": "1.1.2",
"uuid": "c35bb2f6-f24a-4850-ae44-643f2fdc7541",
"isBundle":
tru
e,
"isBundle":
fals
e,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {
"ios":
tru
e,
"android":
tru
e
"ios":
fals
e,
"android":
fals
e
},
"subMetas": {}
}
\ No newline at end of file
assets/cake/scene/cake.fire
View file @
c349b15f
...
...
@@ -87,25 +87,22 @@
"__id__": 15
},
{
"__id__": 38
},
{
"__id__": 87
"__id__": 36
},
{
"__id__":
94
"__id__":
89
},
{
"__id__":
107
"__id__":
96
},
{
"__id__": 109
},
{
"__id__": 1
20
"__id__": 1
11
},
{
"__id__": 12
3
"__id__": 12
2
},
{
"__id__": 125
...
...
@@ -121,18 +118,21 @@
},
{
"__id__": 133
},
{
"__id__": 135
}
],
"_active": true,
"_components": [
{
"__id__": 1
59
"__id__": 1
61
},
{
"__id__": 16
0
"__id__": 16
2
},
{
"__id__": 16
1
"__id__": 16
3
}
],
"_prefab": null,
...
...
@@ -781,10 +781,7 @@
"__id__": 16
},
{
"__id__": 18
},
{
"__id__": 28
"__id__": 26
}
],
"_active": true,
...
...
@@ -837,108 +834,6 @@
"groupIndex": 0,
"_id": "949VRTf5ZN1KxKdKJ8Yzru"
},
{
"__type__": "cc.Node",
"_name": "cake_drop_down",
"_objFlags": 0,
"_parent": {
"__id__": 15
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 17
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 194.01,
"height": 88
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-640,
200,
0,
0,
0,
0,
1,
1,
1,
1.25
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "f4oaqMpVJE1LGucSxbLhcN"
},
{
"__type__": "dragonBones.ArmatureDisplay",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 16
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_armatureName": "Armature",
"_animationName": "newAnimation",
"_preCacheMode": 0,
"_cacheMode": 0,
"playTimes": -1,
"premultipliedAlpha": false,
"_armatureKey": "eb20f6cb-741a-4ee7-b58a-9675a749ab7e#c990989f-66e0-4d66-9ffc-e7ccdb3a82a1",
"_accTime": 0,
"_playCount": 0,
"_frameCache": null,
"_curFrame": null,
"_playing": false,
"_armatureCache": null,
"_N$dragonAsset": {
"__uuid__": "eb20f6cb-741a-4ee7-b58a-9675a749ab7e"
},
"_N$dragonAtlasAsset": {
"__uuid__": "c990989f-66e0-4d66-9ffc-e7ccdb3a82a1"
},
"_N$_defaultArmatureIndex": 0,
"_N$_animationIndex": 1,
"_N$_defaultCacheMode": 0,
"_N$timeScale": 1,
"_N$debugBones": false,
"_N$enableBatch": false,
"_id": "18y8GtWWtOfZlLldtWXD0Y"
},
{
"__type__": "cc.Node",
"_name": "cake_select_01",
...
...
@@ -948,22 +843,22 @@
},
"_children": [
{
"__id__": 1
9
"__id__": 1
7
},
{
"__id__":
21
"__id__":
19
},
{
"__id__": 2
4
"__id__": 2
2
}
],
"_active": false,
"_components": [
{
"__id__": 2
6
"__id__": 2
4
},
{
"__id__": 2
7
"__id__": 2
5
}
],
"_prefab": null,
...
...
@@ -1019,13 +914,13 @@
"_name": "side",
"_objFlags": 0,
"_parent": {
"__id__": 1
8
"__id__": 1
6
},
"_children": [],
"_active": false,
"_components": [
{
"__id__":
20
"__id__":
18
}
],
"_prefab": null,
...
...
@@ -1081,7 +976,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
9
"__id__": 1
7
},
"_enabled": true,
"_materials": [
...
...
@@ -1113,16 +1008,16 @@
"_name": "label",
"_objFlags": 0,
"_parent": {
"__id__": 1
8
"__id__": 1
6
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 2
2
"__id__": 2
0
},
{
"__id__": 2
3
"__id__": 2
1
}
],
"_prefab": null,
...
...
@@ -1178,7 +1073,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
21
"__id__":
19
},
"_enabled": true,
"_materials": [
...
...
@@ -1211,7 +1106,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
21
"__id__":
19
},
"_enabled": true,
"_color": {
...
...
@@ -1229,13 +1124,13 @@
"_name": "cake_drop_down",
"_objFlags": 0,
"_parent": {
"__id__": 1
8
"__id__": 1
6
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 2
5
"__id__": 2
3
}
],
"_prefab": null,
...
...
@@ -1291,7 +1186,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
4
"__id__": 2
2
},
"_enabled": true,
"_materials": [
...
...
@@ -1331,7 +1226,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
8
"__id__": 1
6
},
"_enabled": true,
"_materials": [
...
...
@@ -1363,7 +1258,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
8
"__id__": 1
6
},
"_enabled": true,
"_normalMaterial": null,
...
...
@@ -1435,22 +1330,22 @@
},
"_children": [
{
"__id__": 2
9
"__id__": 2
7
},
{
"__id__":
31
"__id__":
29
},
{
"__id__": 3
4
"__id__": 3
2
}
],
"_active": false,
"_components": [
{
"__id__": 3
6
"__id__": 3
4
},
{
"__id__": 3
7
"__id__": 3
5
}
],
"_prefab": null,
...
...
@@ -1506,13 +1401,13 @@
"_name": "side",
"_objFlags": 0,
"_parent": {
"__id__": 2
8
"__id__": 2
6
},
"_children": [],
"_active": false,
"_components": [
{
"__id__":
30
"__id__":
28
}
],
"_prefab": null,
...
...
@@ -1568,7 +1463,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
9
"__id__": 2
7
},
"_enabled": true,
"_materials": [
...
...
@@ -1600,16 +1495,16 @@
"_name": "label",
"_objFlags": 0,
"_parent": {
"__id__": 2
8
"__id__": 2
6
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 3
2
"__id__": 3
0
},
{
"__id__": 3
3
"__id__": 3
1
}
],
"_prefab": null,
...
...
@@ -1665,7 +1560,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
31
"__id__":
29
},
"_enabled": true,
"_materials": [
...
...
@@ -1700,7 +1595,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
31
"__id__":
29
},
"_enabled": true,
"_color": {
...
...
@@ -1718,13 +1613,13 @@
"_name": "cake_drop_down",
"_objFlags": 0,
"_parent": {
"__id__": 2
8
"__id__": 2
6
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 3
5
"__id__": 3
3
}
],
"_prefab": null,
...
...
@@ -1780,7 +1675,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 3
4
"__id__": 3
2
},
"_enabled": true,
"_materials": [
...
...
@@ -1820,7 +1715,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
8
"__id__": 2
6
},
"_enabled": true,
"_materials": [
...
...
@@ -1852,7 +1747,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
8
"__id__": 2
6
},
"_enabled": true,
"_normalMaterial": null,
...
...
@@ -1924,10 +1819,10 @@
},
"_children": [
{
"__id__": 3
9
"__id__": 3
7
},
{
"__id__":
41
"__id__":
39
},
{
"__id__": 82
...
...
@@ -1988,13 +1883,13 @@
"_name": "desktop",
"_objFlags": 0,
"_parent": {
"__id__": 3
8
"__id__": 3
6
},
"_children": [],
"_active": true,
"_components": [
{
"__id__":
40
"__id__":
38
}
],
"_prefab": null,
...
...
@@ -2050,7 +1945,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 3
9
"__id__": 3
7
},
"_enabled": true,
"_materials": [
...
...
@@ -2082,9 +1977,12 @@
"_name": "cake",
"_objFlags": 0,
"_parent": {
"__id__": 3
8
"__id__": 3
6
},
"_children": [
{
"__id__": 40
},
{
"__id__": 42
},
...
...
@@ -2156,10 +2054,112 @@
},
{
"__type__": "cc.Node",
"_name": "cake_
base
",
"_name": "cake_
drop_down
",
"_objFlags": 0,
"_parent": {
"__id__": 39
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 41
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 194.01,
"height": 88
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
620,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "76w5ypIdNFiaOvuusCrQ3F"
},
{
"__type__": "dragonBones.ArmatureDisplay",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 40
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_armatureName": "Armature",
"_animationName": "newAnimation",
"_preCacheMode": 0,
"_cacheMode": 0,
"playTimes": 1,
"premultipliedAlpha": false,
"_armatureKey": "eb20f6cb-741a-4ee7-b58a-9675a749ab7e#c990989f-66e0-4d66-9ffc-e7ccdb3a82a1",
"_accTime": 0,
"_playCount": 0,
"_frameCache": null,
"_curFrame": null,
"_playing": false,
"_armatureCache": null,
"_N$dragonAsset": {
"__uuid__": "eb20f6cb-741a-4ee7-b58a-9675a749ab7e"
},
"_N$dragonAtlasAsset": {
"__uuid__": "c990989f-66e0-4d66-9ffc-e7ccdb3a82a1"
},
"_N$_defaultArmatureIndex": 0,
"_N$_animationIndex": 1,
"_N$_defaultCacheMode": 0,
"_N$timeScale": 1,
"_N$debugBones": false,
"_N$enableBatch": false,
"_id": "c2Zfnz5KVE27M5tDkmJjBX"
},
{
"__type__": "cc.Node",
"_name": "cake_base",
"_objFlags": 0,
"_parent": {
"__id__": 39
},
"_children": [
{
...
...
@@ -2261,7 +2261,7 @@
"ctor": "Float64Array",
"array": [
0,
0
,
3
,
0,
0,
0,
...
...
@@ -2375,7 +2375,7 @@
"_name": "cake_style_05",
"_objFlags": 0,
"_parent": {
"__id__":
41
"__id__":
39
},
"_children": [
{
...
...
@@ -2574,7 +2574,7 @@
"ctor": "Float64Array",
"array": [
0,
0
,
3
,
0,
0,
0,
...
...
@@ -2688,7 +2688,7 @@
"_name": "cake_style_04",
"_objFlags": 0,
"_parent": {
"__id__":
41
"__id__":
39
},
"_children": [
{
...
...
@@ -2887,7 +2887,7 @@
"ctor": "Float64Array",
"array": [
0,
0
,
3
,
0,
0,
0,
...
...
@@ -3001,7 +3001,7 @@
"_name": "cake_style_03",
"_objFlags": 0,
"_parent": {
"__id__":
41
"__id__":
39
},
"_children": [
{
...
...
@@ -3200,7 +3200,7 @@
"ctor": "Float64Array",
"array": [
0,
0
,
3
,
0,
0,
0,
...
...
@@ -3314,7 +3314,7 @@
"_name": "cake_style_02",
"_objFlags": 0,
"_parent": {
"__id__":
41
"__id__":
39
},
"_children": [
{
...
...
@@ -3513,7 +3513,7 @@
"ctor": "Float64Array",
"array": [
0,
0
,
3
,
0,
0,
0,
...
...
@@ -3627,7 +3627,7 @@
"_name": "cake_style_01",
"_objFlags": 0,
"_parent": {
"__id__":
41
"__id__":
39
},
"_children": [
{
...
...
@@ -3826,7 +3826,7 @@
"ctor": "Float64Array",
"array": [
0,
0
,
3
,
0,
0,
0,
...
...
@@ -3940,7 +3940,7 @@
"_name": "pc",
"_objFlags": 0,
"_parent": {
"__id__": 3
8
"__id__": 3
6
},
"_children": [
{
...
...
@@ -4101,11 +4101,15 @@
"_parent": {
"__id__": 82
},
"_children": [],
"_children": [
{
"__id__": 86
}
],
"_active": true,
"_components": [
{
"__id__": 8
6
"__id__": 8
8
}
],
"_prefab": null,
...
...
@@ -4149,12 +4153,142 @@
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "6dTLynhYZO+aX8+jBftAUg"
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "6dTLynhYZO+aX8+jBftAUg"
},
{
"__type__": "cc.Node",
"_name": "btn_replay",
"_objFlags": 0,
"_parent": {
"__id__": 85
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 87
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1280,
"height": 720
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
2,
2,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "46MpVRk+dJua8Stgsq20jU"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 86
},
"_enabled": true,
"_normalMaterial": null,
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 0,
"transition": 0,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_N$hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_N$normalSprite": null,
"_N$pressedSprite": null,
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": null,
"_id": "e32CgTc1dBFaQ36V8skly1"
},
{
"__type__": "cc.Sprite",
...
...
@@ -4197,7 +4331,7 @@
},
"_children": [
{
"__id__":
88
"__id__":
90
}
],
"_active": true,
...
...
@@ -4255,20 +4389,20 @@
"_name": "candle",
"_objFlags": 0,
"_parent": {
"__id__": 8
7
"__id__": 8
9
},
"_children": [
{
"__id__":
89
"__id__":
91
},
{
"__id__": 9
1
"__id__": 9
3
}
],
"_active": false,
"_components": [
{
"__id__": 9
3
"__id__": 9
5
}
],
"_prefab": null,
...
...
@@ -4324,13 +4458,13 @@
"_name": "cake_timeout_ske",
"_objFlags": 0,
"_parent": {
"__id__":
88
"__id__":
90
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 9
0
"__id__": 9
2
}
],
"_prefab": null,
...
...
@@ -4386,7 +4520,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
89
"__id__":
91
},
"_enabled": true,
"_materials": [
...
...
@@ -4426,13 +4560,13 @@
"_name": "cake_fire_ske",
"_objFlags": 0,
"_parent": {
"__id__":
88
"__id__":
90
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 9
2
"__id__": 9
4
}
],
"_prefab": null,
...
...
@@ -4488,7 +4622,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 9
1
"__id__": 9
3
},
"_enabled": true,
"_materials": [
...
...
@@ -4528,7 +4662,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
88
"__id__":
90
},
"_enabled": true,
"_materials": [
...
...
@@ -4564,13 +4698,13 @@
},
"_children": [
{
"__id__": 9
5
"__id__": 9
7
},
{
"__id__":
98
"__id__":
100
},
{
"__id__": 10
5
"__id__": 10
7
}
],
"_active": true,
...
...
@@ -4628,16 +4762,16 @@
"_name": "btn_submit",
"_objFlags": 0,
"_parent": {
"__id__": 9
4
"__id__": 9
6
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 9
6
"__id__": 9
8
},
{
"__id__": 9
7
"__id__": 9
9
}
],
"_prefab": null,
...
...
@@ -4693,7 +4827,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 9
5
"__id__": 9
7
},
"_enabled": true,
"_materials": [
...
...
@@ -4725,7 +4859,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 9
5
"__id__": 9
7
},
"_enabled": true,
"_normalMaterial": null,
...
...
@@ -4793,23 +4927,23 @@
"_name": "btn_sound",
"_objFlags": 0,
"_parent": {
"__id__": 9
4
"__id__": 9
6
},
"_children": [
{
"__id__":
99
"__id__":
101
},
{
"__id__": 10
1
"__id__": 10
3
}
],
"_active": false,
"_components": [
{
"__id__": 10
3
"__id__": 10
5
},
{
"__id__": 10
4
"__id__": 10
6
}
],
"_prefab": null,
...
...
@@ -4865,13 +4999,13 @@
"_name": "close",
"_objFlags": 0,
"_parent": {
"__id__":
98
"__id__":
100
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 10
0
"__id__": 10
2
}
],
"_prefab": null,
...
...
@@ -4927,7 +5061,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
99
"__id__":
101
},
"_enabled": true,
"_materials": [
...
...
@@ -4959,13 +5093,13 @@
"_name": "open",
"_objFlags": 0,
"_parent": {
"__id__":
98
"__id__":
100
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 10
2
"__id__": 10
4
}
],
"_prefab": null,
...
...
@@ -5021,7 +5155,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 10
1
"__id__": 10
3
},
"_enabled": true,
"_materials": [
...
...
@@ -5053,7 +5187,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
98
"__id__":
100
},
"_enabled": true,
"_materials": [
...
...
@@ -5085,7 +5219,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
98
"__id__":
100
},
"_enabled": true,
"_normalMaterial": null,
...
...
@@ -5153,13 +5287,13 @@
"_name": "offscum",
"_objFlags": 0,
"_parent": {
"__id__": 9
4
"__id__": 9
6
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 10
6
"__id__": 10
8
}
],
"_prefab": null,
...
...
@@ -5215,7 +5349,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 10
5
"__id__": 10
7
},
"_enabled": true,
"_materials": [
...
...
@@ -5253,7 +5387,7 @@
"_active": false,
"_components": [
{
"__id__": 1
08
"__id__": 1
10
}
],
"_prefab": null,
...
...
@@ -5309,7 +5443,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 10
7
"__id__": 10
9
},
"_enabled": true,
"_materials": [
...
...
@@ -5345,10 +5479,10 @@
},
"_children": [
{
"__id__": 11
0
"__id__": 11
2
},
{
"__id__": 11
2
"__id__": 11
4
}
],
"_active": true,
...
...
@@ -5406,13 +5540,13 @@
"_name": "layout",
"_objFlags": 0,
"_parent": {
"__id__": 1
09
"__id__": 1
11
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 11
1
"__id__": 11
3
}
],
"_prefab": null,
...
...
@@ -5468,7 +5602,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 11
0
"__id__": 11
2
},
"_enabled": true,
"_layoutSize": {
...
...
@@ -5500,23 +5634,23 @@
"_name": "item",
"_objFlags": 0,
"_parent": {
"__id__": 1
09
"__id__": 1
11
},
"_children": [
{
"__id__": 113
},
{
"__id__": 115
},
{
"__id__": 117
},
{
"__id__": 119
}
],
"_active": false,
"_components": [
{
"__id__": 1
19
"__id__": 1
21
}
],
"_prefab": null,
...
...
@@ -5572,13 +5706,13 @@
"_name": "bule",
"_objFlags": 0,
"_parent": {
"__id__": 11
2
"__id__": 11
4
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 11
4
"__id__": 11
6
}
],
"_prefab": null,
...
...
@@ -5634,7 +5768,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 11
3
"__id__": 11
5
},
"_enabled": true,
"_materials": [
...
...
@@ -5666,13 +5800,13 @@
"_name": "red",
"_objFlags": 0,
"_parent": {
"__id__": 11
2
"__id__": 11
4
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 11
6
"__id__": 11
8
}
],
"_prefab": null,
...
...
@@ -5728,7 +5862,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 11
5
"__id__": 11
7
},
"_enabled": true,
"_materials": [
...
...
@@ -5760,13 +5894,13 @@
"_name": "tag",
"_objFlags": 0,
"_parent": {
"__id__": 11
2
"__id__": 11
4
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 1
18
"__id__": 1
20
}
],
"_prefab": null,
...
...
@@ -5822,7 +5956,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 11
7
"__id__": 11
9
},
"_enabled": true,
"_materials": [
...
...
@@ -5854,7 +5988,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 11
2
"__id__": 11
4
},
"_enabled": true,
"_materials": [
...
...
@@ -5892,10 +6026,10 @@
"_active": false,
"_components": [
{
"__id__": 12
1
"__id__": 12
3
},
{
"__id__": 12
2
"__id__": 12
4
}
],
"_prefab": null,
...
...
@@ -5951,7 +6085,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 12
0
"__id__": 12
2
},
"_enabled": true,
"_materials": [
...
...
@@ -5983,7 +6117,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 12
0
"__id__": 12
2
},
"_enabled": true,
"_normalMaterial": null,
...
...
@@ -6057,7 +6191,7 @@
"_active": false,
"_components": [
{
"__id__": 12
4
"__id__": 12
6
}
],
"_prefab": null,
...
...
@@ -6113,7 +6247,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 12
3
"__id__": 12
5
},
"_enabled": true,
"_materials": [
...
...
@@ -6159,7 +6293,7 @@
"_active": false,
"_components": [
{
"__id__": 12
6
"__id__": 12
8
}
],
"_prefab": null,
...
...
@@ -6215,7 +6349,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 12
5
"__id__": 12
7
},
"_enabled": true,
"_materials": [
...
...
@@ -6223,7 +6357,7 @@
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor":
770
,
"_srcBlendFactor":
1
,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "8658bd9b-be18-4632-90b8-76427a1c1d35"
...
...
@@ -6253,7 +6387,7 @@
"_active": false,
"_components": [
{
"__id__": 1
28
"__id__": 1
30
}
],
"_prefab": null,
...
...
@@ -6309,7 +6443,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 12
7
"__id__": 12
9
},
"_enabled": true,
"_materials": [
...
...
@@ -6347,7 +6481,7 @@
"_active": false,
"_components": [
{
"__id__": 13
0
"__id__": 13
2
}
],
"_prefab": null,
...
...
@@ -6403,7 +6537,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
29
"__id__": 1
31
},
"_enabled": true,
"_materials": [
...
...
@@ -6441,7 +6575,7 @@
"_active": false,
"_components": [
{
"__id__": 13
2
"__id__": 13
4
}
],
"_prefab": null,
...
...
@@ -6497,7 +6631,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 13
1
"__id__": 13
3
},
"_enabled": true,
"_materials": [
...
...
@@ -6541,13 +6675,13 @@
},
"_children": [
{
"__id__": 13
4
"__id__": 13
6
},
{
"__id__": 13
7
"__id__": 13
9
},
{
"__id__": 14
2
"__id__": 14
4
}
],
"_active": false,
...
...
@@ -6605,11 +6739,11 @@
"_name": "font",
"_objFlags": 0,
"_parent": {
"__id__": 13
3
"__id__": 13
5
},
"_children": [
{
"__id__": 13
5
"__id__": 13
7
}
],
"_active": true,
...
...
@@ -6667,13 +6801,13 @@
"_name": "BRLNSDB",
"_objFlags": 0,
"_parent": {
"__id__": 13
4
"__id__": 13
6
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 13
6
"__id__": 13
8
}
],
"_prefab": null,
...
...
@@ -6729,7 +6863,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 13
5
"__id__": 13
7
},
"_enabled": true,
"_materials": [],
...
...
@@ -6760,14 +6894,14 @@
"_name": "img",
"_objFlags": 0,
"_parent": {
"__id__": 13
3
"__id__": 13
5
},
"_children": [
{
"__id__": 1
38
"__id__": 1
40
},
{
"__id__": 14
0
"__id__": 14
2
}
],
"_active": true,
...
...
@@ -6825,13 +6959,13 @@
"_name": "candle_select",
"_objFlags": 0,
"_parent": {
"__id__": 13
7
"__id__": 13
9
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 1
39
"__id__": 1
41
}
],
"_prefab": null,
...
...
@@ -6887,7 +7021,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
38
"__id__": 1
40
},
"_enabled": true,
"_materials": [],
...
...
@@ -6915,13 +7049,13 @@
"_name": "candle_test",
"_objFlags": 0,
"_parent": {
"__id__": 13
7
"__id__": 13
9
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 14
1
"__id__": 14
3
}
],
"_prefab": null,
...
...
@@ -6977,7 +7111,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 14
0
"__id__": 14
2
},
"_enabled": true,
"_materials": [],
...
...
@@ -7005,12 +7139,9 @@
"_name": "audio",
"_objFlags": 0,
"_parent": {
"__id__": 13
3
"__id__": 13
5
},
"_children": [
{
"__id__": 143
},
{
"__id__": 145
},
...
...
@@ -7031,6 +7162,9 @@
},
{
"__id__": 157
},
{
"__id__": 159
}
],
"_active": true,
...
...
@@ -7088,13 +7222,13 @@
"_name": "enter",
"_objFlags": 0,
"_parent": {
"__id__": 14
2
"__id__": 14
4
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 14
4
"__id__": 14
6
}
],
"_prefab": null,
...
...
@@ -7150,7 +7284,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 14
3
"__id__": 14
5
},
"_enabled": true,
"_clip": {
...
...
@@ -7169,13 +7303,13 @@
"_name": "right",
"_objFlags": 0,
"_parent": {
"__id__": 14
2
"__id__": 14
4
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 14
6
"__id__": 14
8
}
],
"_prefab": null,
...
...
@@ -7231,7 +7365,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 14
5
"__id__": 14
7
},
"_enabled": true,
"_clip": {
...
...
@@ -7250,13 +7384,13 @@
"_name": "voice_test_nice_try",
"_objFlags": 0,
"_parent": {
"__id__": 14
2
"__id__": 14
4
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 1
48
"__id__": 1
50
}
],
"_prefab": null,
...
...
@@ -7312,7 +7446,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 14
7
"__id__": 14
9
},
"_enabled": true,
"_clip": {
...
...
@@ -7331,13 +7465,13 @@
"_name": "voice_test_excellent",
"_objFlags": 0,
"_parent": {
"__id__": 14
2
"__id__": 14
4
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 15
0
"__id__": 15
2
}
],
"_prefab": null,
...
...
@@ -7393,7 +7527,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
49
"__id__": 1
51
},
"_enabled": true,
"_clip": {
...
...
@@ -7412,13 +7546,13 @@
"_name": "error",
"_objFlags": 0,
"_parent": {
"__id__": 14
2
"__id__": 14
4
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 15
2
"__id__": 15
4
}
],
"_prefab": null,
...
...
@@ -7474,7 +7608,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 15
1
"__id__": 15
3
},
"_enabled": true,
"_clip": {
...
...
@@ -7493,13 +7627,13 @@
"_name": "game_over_came_on",
"_objFlags": 0,
"_parent": {
"__id__": 14
2
"__id__": 14
4
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 15
4
"__id__": 15
6
}
],
"_prefab": null,
...
...
@@ -7555,7 +7689,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 15
3
"__id__": 15
5
},
"_enabled": true,
"_clip": {
...
...
@@ -7574,13 +7708,13 @@
"_name": "game_over_nice_try",
"_objFlags": 0,
"_parent": {
"__id__": 14
2
"__id__": 14
4
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 15
6
"__id__": 15
8
}
],
"_prefab": null,
...
...
@@ -7636,7 +7770,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 15
5
"__id__": 15
7
},
"_enabled": true,
"_clip": {
...
...
@@ -7655,13 +7789,13 @@
"_name": "all_right",
"_objFlags": 0,
"_parent": {
"__id__": 14
2
"__id__": 14
4
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 1
58
"__id__": 1
60
}
],
"_prefab": null,
...
...
@@ -7717,7 +7851,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 15
7
"__id__": 15
9
},
"_enabled": true,
"_clip": {
...
...
assets/cake/scene/cake.ts
View file @
c349b15f
/*
* @Author: ls
* @Date: 2022-03-09 21:15:44
* @LastEditTime: 2022-03-15 1
1:50:32
* @LastEditTime: 2022-03-15 1
7:46:21
* @LastEditors: ls
* @Description: 蛋糕
* @FilePath: \cake\assets\cake\scene\cake.ts
...
...
@@ -47,6 +47,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
_results
=
null
;
// 题目结果
_sounding
=
null
;
// 播放题干中
_replaying
=
null
;
// 评测动画播放中
_schedule_candle
=
null
;
// 蜡烛燃烧回调
_timeout
=
null
;
// 倒计时
...
...
@@ -56,6 +58,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
_curPage
=
0
;
this
.
_results
=
[];
this
.
_sounding
=
false
;
this
.
_replaying
=
false
;
this
.
_schedule_candle
=
null
;
this
.
_timeout
=
0
;
...
...
@@ -178,8 +181,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
// 隐藏选项
let
cake_drop_down
=
cc
.
find
(
'
right/cake_drop_down
'
,
this
.
node
);
cake_drop_down
.
active
=
false
;
let
cake_select_01
=
cc
.
find
(
'
right/cake_select_01
'
,
this
.
node
);
cake_select_01
.
active
=
false
;
let
cake_select_02
=
cc
.
find
(
'
right/cake_select_02
'
,
this
.
node
);
...
...
@@ -275,12 +276,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 蛋糕底座显示完整单词
let
cake_base
=
cake
.
getChildByName
(
'
cake_base
'
);
cake_base
.
active
=
true
;
cake
.
getChildByName
(
'
cake_drop_down
'
).
active
=
false
;
cake_base
.
getChildByName
(
'
label
'
).
getComponent
(
cc
.
Label
).
string
=
problem
.
text
;
// 根据单词长度显示蛋糕
for
(
let
index
=
0
;
index
<
problem
.
text
.
length
-
1
;
index
++
)
{
let
show_cake
=
cake
.
getChildByName
(
`cake_style_0
${
index
+
1
}
`
);
show_cake
.
active
=
true
;
show_cake
.
getChildByName
(
'
label
'
).
getComponent
(
cc
.
Label
).
string
=
problem
.
text
[
index
];
show_cake
.
getChildByName
(
'
side
'
).
active
=
false
;
}
// 移入选项蛋糕
...
...
@@ -290,6 +293,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
cc
.
Tween
.
stopAllByTarget
(
cake_select_02
);
cake_select_01
.
x
=
200
;
cake_select_02
.
x
=
200
;
cake_select_01
.
y
=
100
;
cake_select_02
.
y
=
-
100
;
cake_select_01
.
active
=
true
;
cake_select_02
.
active
=
true
;
cc
.
tween
(
cake_select_01
).
to
(
0.5
,
{
x
:
-
200
}).
start
();
...
...
@@ -430,12 +435,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
cc
.
tween
(
cake_select_right
)
.
to
(
0.5
,
{
position
:
cc
.
v3
(
tarRightPos
),
scale
:
cake_style
.
scale
})
.
call
(()
=>
{
// let cake_drop_down = cake_select_right.getChildByName('cake_drop_down');
// cake_drop_down.x = 0;
// cake_drop_down.y = cake_style.scale * 50;
let
cake_drop_down
=
cc
.
find
(
'
right/cake_drop_down
'
,
self
.
node
);
cake_drop_down
.
x
=
tarRightPos
.
x
;
cake_drop_down
.
y
=
tarRightPos
.
y
+
cake_style
.
scale
*
50
;
cake_select_right
.
active
=
false
;
cake_select_right
.
scale
=
0.8
;
cake_select_right
.
getChildByName
(
'
side
'
).
active
=
false
;
cake_style
.
active
=
true
;
cake_style
.
getChildByName
(
'
label
'
).
getComponent
(
cc
.
Label
).
string
=
problem
.
rightLetter
;
cake_style
.
getChildByName
(
'
side
'
).
active
=
true
;
let
cake_drop_down
=
cake
.
getChildByName
(
'
cake_drop_down
'
);
cake_drop_down
.
y
=
tarNodePos
.
y
+
50
*
cake_style
.
scale
;
cake_drop_down
.
active
=
true
;
let
dragonBones_cake_drop_down
=
cake_drop_down
.
getComponent
(
dragonBones
.
ArmatureDisplay
);
dragonBones_cake_drop_down
.
playAnimation
(
'
newAnimation
'
,
1
);
...
...
@@ -447,7 +455,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 移除错误选项点击事件
cake_select_wrong
.
off
(
'
click
'
);
//
隐藏
干扰选项蛋糕
//
移出
干扰选项蛋糕
// cake_select_wrong.x = -200;
cake_select_wrong
.
active
=
true
;
cc
.
Tween
.
stopAllByTarget
(
cake_select_wrong
);
...
...
@@ -475,11 +483,20 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
initGame
();
}
startTest
()
{
// TODO 结束录音
// TODO 开始测评
// window['courseware'].startTest();
this
.
stopTest
();
startTest
(
value
)
{
// 开始系统评测
window
[
'
courseware
'
].
startTest
(
value
);
}
stopTest
()
{
// 结束系统评测
window
[
'
courseware
'
].
stopTest
((
res
)
=>
{
// 模拟数据
// let res = '{"result":{"overall":100}}';
let
replay
=
cc
.
find
(
'
down/pc/frame/btn_replay
'
,
this
.
node
);
replay
.
off
(
'
click
'
);
replay
.
active
=
false
;
// 渐显遮罩
let
mask
=
cc
.
find
(
'
mask
'
,
this
.
node
);
...
...
@@ -487,7 +504,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
mask
.
active
=
true
;
cc
.
Tween
.
stopAllByTarget
(
mask
);
cc
.
tween
(
mask
).
to
(
0.5
,
{
opacity
:
255
}).
start
();
// TODO 文档未体现 移除蜡烛和提交
// 移出提交
let
submit
=
cc
.
find
(
'
right_down/btn_submit
'
,
this
.
node
);
...
...
@@ -515,28 +531,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
cc
.
Tween
.
stopAllByTarget
(
candle
);
cc
.
tween
(
candle
).
to
(
0.5
,
{
x
:
-
80
}).
start
();
// TODO 开始测评 使用setTimeout 模拟
setTimeout
(()
=>
{
// this.playLocalAudio('voice_test_excellent');
// // 显示贴图
// let layout = cc.find('right_up/layout', this.node);
// layout.active = true;
// let curTag = layout.children[this._curPage];
// if (curTag) {
// curTag.getChildByName('bule').active = false;
// curTag.getChildByName('red').active = false;
// let tag = curTag.getChildByName('tag');
// tag.active = true;
// tag.opacity = 0;
// tag.scale = 0.5;
// cc.tween(tag).to(0.7, { opacity: 255, scale: 1.2 }).to(0.2, { scale: 1 }).start();
// }
// let excellent = cc.find('excellent_ske', this.node);
// excellent.active = true;
// let dragonBones_excellent = excellent.getComponent(dragonBones.ArmatureDisplay);
// dragonBones_excellent.playAnimation('newAnimation', 1);
res
=
JSON
.
parse
(
res
);
if
(
res
[
'
result
'
].
overall
<
80
)
{
this
.
_results
[
this
.
_curPage
]
=
false
;
this
.
playLocalAudio
(
'
voice_test_nice_try
'
);
let
layout
=
cc
.
find
(
'
right_up/layout
'
,
this
.
node
);
layout
.
active
=
true
;
let
curTag
=
layout
.
children
[
this
.
_curPage
];
...
...
@@ -546,57 +546,75 @@ export default class SceneComponent extends MyCocosSceneComponent {
curTag
.
getChildByName
(
'
tag
'
).
active
=
false
;
curTag
.
getChildByName
(
'
red
'
).
active
=
true
;
}
let
winSizeH
=
this
.
node
.
height
;
// 移入测评nice try
let
test_nice_try
=
cc
.
find
(
'
test_nice_try
'
,
this
.
node
);
cc
.
Tween
.
stopAllByTarget
(
test_nice_try
);
test_nice_try
.
x
=
0
;
test_nice_try
.
y
=
winSizeH
*
0.5
+
400
;
test_nice_try
.
y
=
this
.
node
.
height
*
0.5
+
400
;
test_nice_try
.
active
=
true
;
cc
.
Tween
.
stopAllByTarget
(
test_nice_try
);
cc
.
tween
(
test_nice_try
)
.
to
(
0.7
,
{
y
:
0
},
{
easing
:
'
backOut
'
})
.
delay
(
1
)
.
to
(
0.3
,
{
y
:
-
winSizeH
*
0.5
-
400
},
{
easing
:
'
sineIn
'
})
.
to
(
0.3
,
{
y
:
-
this
.
node
.
height
*
0.5
-
400
},
{
easing
:
'
sineIn
'
})
.
call
(()
=>
{
test_nice_try
.
active
=
tru
e
;
test_nice_try
.
active
=
fals
e
;
})
.
start
();
// cc.Tween.stopAllByTarget(test_nice_try);
// cc.tween(test_nice_try)
// .to(0.5, { y: -winSizeH
* 0.1 }, { easing: 'sineIn' })
// .to(0.5, { y: -this.node.height
* 0.1 }, { easing: 'sineIn' })
// .to(0.2, { y: 0 }, { easing: 'sineOut' })
// .delay(1)
// .to(0.3, { y: -winSizeH
* 0.5 - 400 }, { easing: 'sineIn' })
// .to(0.3, { y: -this.node.height
* 0.5 - 400 }, { easing: 'sineIn' })
// .call(() => {
// test_nice_try.active = true;
// })
// .start();
},
3000
);
}
}
else
{
this
.
_results
[
this
.
_curPage
]
=
true
;
stopTest
()
{
// window['courseware'].stopTest((res) => {
// console.log(res);
// console.log(res.overall);
// });
this
.
playLocalAudio
(
'
voice_test_excellent
'
);
// 显示贴图
let
layout
=
cc
.
find
(
'
right_up/layout
'
,
this
.
node
);
layout
.
active
=
true
;
let
curTag
=
layout
.
children
[
this
.
_curPage
];
if
(
curTag
)
{
curTag
.
getChildByName
(
'
bule
'
).
active
=
false
;
curTag
.
getChildByName
(
'
red
'
).
active
=
false
;
let
tag
=
curTag
.
getChildByName
(
'
tag
'
);
tag
.
active
=
true
;
tag
.
opacity
=
0
;
tag
.
scale
=
0.5
;
cc
.
tween
(
tag
).
to
(
0.7
,
{
opacity
:
255
,
scale
:
1.2
}).
to
(
0.2
,
{
scale
:
1
}).
start
();
}
let
test_excellent
=
cc
.
find
(
'
test_excellent
'
,
this
.
node
);
test_excellent
.
active
=
true
;
let
dragonBones_test_excellent
=
test_excellent
.
getComponent
(
dragonBones
.
ArmatureDisplay
);
dragonBones_test_excellent
.
playAnimation
(
'
newAnimation
'
,
1
);
dragonBones_test_excellent
.
off
(
dragonBones
.
EventObject
.
COMPLETE
);
dragonBones_test_excellent
.
once
(
dragonBones
.
EventObject
.
COMPLETE
,
()
=>
{
test_excellent
.
active
=
false
;
});
}
this
.
unschedule
(
this
.
completeGame
);
this
.
scheduleOnce
(
this
.
completeGame
,
1
);
});
}
completeGame
()
{
// 渐显遮罩
let
mask
=
cc
.
find
(
'
mask
'
,
this
.
node
);
mask
.
opacity
=
0
;
// 移出pc
let
pc
=
cc
.
find
(
'
down/pc
'
,
this
.
node
);
// pc.x = 0;
pc
.
active
=
true
;
cc
.
Tween
.
stopAllByTarget
(
pc
);
cc
.
tween
(
pc
)
.
to
(
0.5
,
{
x
:
-
this
.
node
.
width
/
2
-
400
})
mask
.
opacity
=
255
;
mask
.
active
=
true
;
cc
.
Tween
.
stopAllByTarget
(
mask
);
cc
.
tween
(
mask
)
.
to
(
0.5
,
{
opacity
:
0
})
.
call
(()
=>
{})
.
start
();
this
.
overTime
();
}
selectRight
()
{
...
...
@@ -647,6 +665,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
cc
.
tween
(
pc
)
.
to
(
0.5
,
{
y
:
0
})
.
call
(()
=>
{
cc
.
find
(
'
down/cake
'
,
this
.
node
).
active
=
false
;
// 移入提交
let
submit
=
cc
.
find
(
'
right_down/btn_submit
'
,
self
.
node
);
submit
.
off
(
'
click
'
);
...
...
@@ -654,18 +674,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
submit
.
active
=
true
;
cc
.
Tween
.
stopAllByTarget
(
submit
);
cc
.
tween
(
submit
).
to
(
0.5
,
{
x
:
-
120
}).
start
();
submit
.
once
(
'
click
'
,
()
=>
{
console
.
log
(
'
点击提交,结束录音,开始测评
'
);
// 移除蜡烛燃烧回调
if
(
self
.
_schedule_candle
)
{
self
.
_timeout
=
0
;
self
.
unschedule
(
self
.
_schedule_candle
);
self
.
_schedule_candle
=
null
;
// 移除蜡烛 schedule
}
// 开始测评(结束录音)
self
.
startTest
();
});
// 移除蜡烛燃烧回调
if
(
self
.
_schedule_candle
)
{
...
...
@@ -687,9 +695,45 @@ export default class SceneComponent extends MyCocosSceneComponent {
cake_fire
.
active
=
true
;
cake_timeout
.
active
=
false
;
// 播放骨骼动画
let
frame
=
cc
.
find
(
'
down/pc/frame
'
,
self
.
node
);
let
replay
=
cc
.
find
(
'
down/pc/frame/btn_replay
'
,
self
.
node
);
replay
.
active
=
false
;
replay
.
on
(
'
click
'
,
()
=>
{
if
(
self
.
_replaying
)
return
;
self
.
asyncLoadDragonBoneAnime
(
frame
,
problem
.
dragonBoneData
).
then
((
node
:
cc
.
Node
)
=>
{
self
.
_replaying
=
true
;
let
dragonBones_test
=
node
.
getComponent
(
dragonBones
.
ArmatureDisplay
);
dragonBones_test
.
playAnimation
(
'
newAnimation
'
,
1
);
dragonBones_test
.
off
(
dragonBones
.
EventObject
.
COMPLETE
);
dragonBones_test
.
once
(
dragonBones
.
EventObject
.
COMPLETE
,
()
=>
{
node
.
destroy
();
node
=
null
;
replay
.
active
=
true
;
self
.
_replaying
=
false
;
});
});
});
self
.
asyncLoadDragonBoneAnime
(
frame
,
problem
.
dragonBoneData
).
then
((
node
:
cc
.
Node
)
=>
{
let
dragonBones_test
=
node
.
getComponent
(
dragonBones
.
ArmatureDisplay
);
dragonBones_test
.
playAnimation
(
'
newAnimation
'
,
1
);
dragonBones_test
.
off
(
dragonBones
.
EventObject
.
COMPLETE
);
dragonBones_test
.
once
(
dragonBones
.
EventObject
.
COMPLETE
,
()
=>
{
node
.
destroy
();
node
=
null
;
replay
.
active
=
true
;
});
});
// 播放语音评测引导音频
self
.
playAudioByUrl
(
self
.
data
.
guideAudio
,
()
=>
{
// TODO 开始录音
// 开始评测
this
.
startTest
(
problem
.
text
);
self
.
_timeout
=
problem
.
testWaitTime
;
// 蜡烛燃烧回调
...
...
@@ -704,8 +748,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
cake_fire
.
active
=
false
;
self
.
_timeout
=
0
;
// 开始测评(结束录音)
self
.
st
art
Test
();
console
.
log
(
'
蜡烛燃尽
'
);
self
.
st
op
Test
();
}
else
if
(
ratio
<=
0.2
)
{
cake_fire
.
active
=
false
;
cake_timeout
.
active
=
true
;
...
...
@@ -717,18 +761,17 @@ export default class SceneComponent extends MyCocosSceneComponent {
};
// 蜡烛开始燃烧
self
.
schedule
(
self
.
_schedule_candle
);
});
// 播放骨骼动画
let
frame
=
cc
.
find
(
'
down/pc/frame
'
,
self
.
node
);
self
.
asyncLoadDragonBoneAnime
(
frame
,
problem
.
dragonBoneData
).
then
((
node
:
cc
.
Node
)
=>
{
let
dragonBones_test
=
node
.
getComponent
(
dragonBones
.
ArmatureDisplay
);
dragonBones_test
.
playAnimation
(
'
newAnimation
'
,
1
)
;
dragonBones_test
.
off
(
dragonBones
.
EventObject
.
COMPLETE
);
dragonBones_test
.
once
(
dragonBones
.
EventObject
.
COMPLETE
,
()
=>
{
node
.
active
=
false
;
node
.
destroy
();
node
=
null
;
submit
.
once
(
'
click
'
,
()
=>
{
console
.
log
(
'
点击提交=
'
);
// 移除蜡烛燃烧回调
if
(
self
.
_schedule_candle
)
{
self
.
_timeout
=
0
;
self
.
unschedule
(
self
.
_schedule_candle
);
self
.
_schedule_candle
=
null
;
// 移除蜡烛 schedule
}
self
.
stopTest
()
;
});
});
})
...
...
@@ -802,16 +845,34 @@ export default class SceneComponent extends MyCocosSceneComponent {
for
(
let
index
=
0
;
index
<
this
.
_results
.
length
;
index
++
)
{
if
(
this
.
_results
[
index
])
numRight
++
;
}
if
(
numRight
===
this
.
_results
.
length
)
{
this
.
allRight
();
}
else
{
if
(
numRight
/
this
.
_results
.
length
<
0.6
)
{
this
.
comeOn
();
}
else
{
this
.
niceTry
();
}
}
}
else
{
// 开始下一题
this
.
_curPage
++
;
this
.
resetGame
();
// 移出pc
let
pc
=
cc
.
find
(
'
down/pc
'
,
this
.
node
);
if
(
pc
.
active
)
{
// pc.x = 0;
cc
.
Tween
.
stopAllByTarget
(
pc
);
cc
.
tween
(
pc
)
.
to
(
0.5
,
{
x
:
-
this
.
node
.
width
/
2
-
400
,
active
:
true
})
.
call
(()
=>
{
pc
.
active
=
false
;
})
.
start
();
}
this
.
initGame
();
}
}
...
...
@@ -819,7 +880,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
comeOn
()
{
let
pc
=
cc
.
find
(
'
down/pc
'
,
this
.
node
);
if
(
pc
.
active
)
{
// TODO 文档未体现
this
.
playLocalAudio
(
'
game_over_came_on
'
);
let
come_on
=
cc
.
find
(
'
come_on
'
,
this
.
node
);
cc
.
Tween
.
stopAllByTarget
(
come_on
);
...
...
@@ -835,6 +895,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
})
.
start
();
}
else
{
// TODO 文档未体现
// 移入pc
cc
.
Tween
.
stopAllByTarget
(
pc
);
pc
.
x
=
0
;
...
...
@@ -843,6 +905,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
cc
.
tween
(
pc
)
.
to
(
0.5
,
{
y
:
0
})
.
call
(()
=>
{
cc
.
find
(
'
down/cake
'
,
this
.
node
).
active
=
false
;
this
.
playLocalAudio
(
'
game_over_came_on
'
);
let
come_on
=
cc
.
find
(
'
come_on
'
,
this
.
node
);
cc
.
Tween
.
stopAllByTarget
(
come_on
);
...
...
@@ -860,6 +924,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
})
.
start
();
}
// cc.tween(come_on)
// .to(0.5, { y: -this.node.height * 0.1 }, { easing: 'sineIn' })
// .to(0.2, { y: 0 }, { easing: 'sineOut' })
...
...
@@ -874,8 +939,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
niceTry
()
{
let
pc
=
cc
.
find
(
'
down/pc
'
,
this
.
node
);
if
(
pc
.
active
)
{
// TODO 文档未体现
this
.
playLocalAudio
(
'
game_over_nice_try
'
);
let
nice_try
=
cc
.
find
(
'
nice_try
'
,
this
.
node
);
cc
.
Tween
.
stopAllByTarget
(
nice_try
);
nice_try
.
x
=
0
;
...
...
@@ -890,6 +955,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
})
.
start
();
}
else
{
// TODO 文档未体现
// 移入pc
cc
.
Tween
.
stopAllByTarget
(
pc
);
pc
.
x
=
0
;
...
...
@@ -898,6 +965,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
cc
.
tween
(
pc
)
.
to
(
0.5
,
{
y
:
0
})
.
call
(()
=>
{
cc
.
find
(
'
down/cake
'
,
this
.
node
).
active
=
false
;
this
.
playLocalAudio
(
'
game_over_nice_try
'
);
let
nice_try
=
cc
.
find
(
'
nice_try
'
,
this
.
node
);
cc
.
Tween
.
stopAllByTarget
(
nice_try
);
...
...
@@ -928,11 +997,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
allRight
()
{
this
.
playLocalAudio
(
'
all_right
'
);
let
pc
=
cc
.
find
(
'
down/pc
'
,
this
.
node
);
if
(
pc
.
active
)
{
// TODO 文档未体现
this
.
playLocalAudio
(
'
all_right
'
);
let
all_right
=
cc
.
find
(
'
all_right
'
,
this
.
node
);
all_right
.
active
=
true
;
...
...
@@ -943,6 +1011,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
all_right
.
active
=
false
;
});
}
else
{
// TODO 文档未体现
this
.
playLocalAudio
(
'
all_right
'
);
// 移入pc
cc
.
Tween
.
stopAllByTarget
(
pc
);
pc
.
x
=
0
;
...
...
@@ -951,6 +1022,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
cc
.
tween
(
pc
)
.
to
(
0.5
,
{
y
:
0
})
.
call
(()
=>
{
cc
.
find
(
'
down/cake
'
,
this
.
node
).
active
=
false
;
let
all_right
=
cc
.
find
(
'
all_right
'
,
this
.
node
);
all_right
.
active
=
true
;
...
...
assets/cake/scene/cocos_generator.fire
deleted
100644 → 0
View file @
05f8ab0c
[
{
"__type__": "cc.SceneAsset",
"_name": "",
"_objFlags": 0,
"_native": "",
"scene": {
"__id__": 1
}
},
{
"__type__": "cc.Scene",
"_objFlags": 0,
"_parent": null,
"_children": [
{
"__id__": 2
}
],
"_active": false,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_is3DNode": true,
"_groupIndex": 0,
"groupIndex": 0,
"autoReleaseAssets": true,
"_id": "0737ce42-24f0-45c6-8e1a-8bdab4f74ba3"
},
{
"__type__": "cc.Node",
"_name": "Canvas",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 3
},
{
"__id__": 5
},
{
"__id__": 7
},
{
"__id__": 14
}
],
"_active": true,
"_components": [
{
"__id__": 24
},
{
"__id__": 25
},
{
"__id__": 26
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1280,
"height": 720
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
640,
360,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "a5esZu+45LA5mBpvttspPD"
},
{
"__type__": "cc.Node",
"_name": "Main Camera",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 4
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1280,
"height": 720
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
362.85545494732423,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "e1WoFrQ79G7r4ZuQE3HlNb"
},
{
"__type__": "cc.Camera",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 3
},
"_enabled": true,
"_cullingMask": 4294967295,
"_clearFlags": 7,
"_backgroundColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_depth": -1,
"_zoomRatio": 1,
"_targetTexture": null,
"_fov": 60,
"_orthoSize": 10,
"_nearClip": 1,
"_farClip": 4096,
"_ortho": true,
"_rect": {
"__type__": "cc.Rect",
"x": 0,
"y": 0,
"width": 1,
"height": 1
},
"_renderStages": 1,
"_alignWithScreen": true,
"_id": "81GN3uXINKVLeW4+iKSlim"
},
{
"__type__": "cc.Node",
"_name": "bg",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 6
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1280,
"height": 720
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "32MJMZ2HRGF4BOf533Avyi"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "8288e3d4-4c75-4b27-8f01-f7014417f4dd"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "97/S6HDq9MeqgmV1Zwnhbb"
},
{
"__type__": "cc.Node",
"_name": "bottomPart",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [
{
"__id__": 8
},
{
"__id__": 11
}
],
"_active": true,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
635.132,
-356.326,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "8c7k8ep/ZFNpO263+1QHz9"
},
{
"__type__": "cc.Node",
"_name": "btn_left",
"_objFlags": 0,
"_parent": {
"__id__": 7
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 9
},
{
"__id__": 10
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 61,
"height": 67
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-148.464,
34,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "5ad2wLQLxIN5Eg7OHecSH6"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 8
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "ce19457d-e8f3-4c38-ae3e-d4b99208ddb5"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "84mqOgJ3JNqZrYVTEU8CjE"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 8
},
"_enabled": true,
"_normalMaterial": null,
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 0,
"transition": 0,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_N$hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_N$normalSprite": null,
"_N$pressedSprite": null,
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": null,
"_id": "bcYN/4EKBJhbIAfovo9Ah1"
},
{
"__type__": "cc.Node",
"_name": "btn_right",
"_objFlags": 0,
"_parent": {
"__id__": 7
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 12
},
{
"__id__": 13
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 60,
"height": 66
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-47.164,
34,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "46i3stdzpHX6zQHTGnRsNE"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 11
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "e5a2dbaa-a677-4a32-90d7-a1b057d7fb59"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "42Sh8QS/BHn4WiGyPQPKPt"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 11
},
"_enabled": true,
"_normalMaterial": null,
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 0,
"transition": 0,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_N$hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_N$normalSprite": null,
"_N$pressedSprite": null,
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": null,
"_id": "1aj32fYY1IxLesa77E70Qu"
},
{
"__type__": "cc.Node",
"_name": "res",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [
{
"__id__": 15
},
{
"__id__": 18
},
{
"__id__": 21
}
],
"_active": false,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "0aAzbH6R1E+6AmGRrkKa5O"
},
{
"__type__": "cc.Node",
"_name": "font",
"_objFlags": 0,
"_parent": {
"__id__": 14
},
"_children": [
{
"__id__": 16
}
],
"_active": true,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "9bLfcYeeNKrr524vzWchiM"
},
{
"__type__": "cc.Node",
"_name": "BRLNSDB",
"_objFlags": 0,
"_parent": {
"__id__": 15
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 17
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "cfMLGsq0BMhJARv+ySMAxS"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 16
},
"_enabled": true,
"_materials": [],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "",
"_N$string": "",
"_fontSize": 40,
"_lineHeight": 40,
"_enableWrapText": true,
"_N$file": {
"__uuid__": "c551970e-b095-45f3-9f1d-25cde8b8deb1"
},
"_isSystemFontUsed": false,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 0,
"_N$verticalAlign": 0,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": "9bNHNPu5lC7rQYyr8ai/sY"
},
{
"__type__": "cc.Node",
"_name": "img",
"_objFlags": 0,
"_parent": {
"__id__": 14
},
"_children": [
{
"__id__": 19
}
],
"_active": true,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "53LUHHG2pEr79fyrvazXJs"
},
{
"__type__": "cc.Node",
"_name": "icon",
"_objFlags": 0,
"_parent": {
"__id__": 18
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 20
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 138,
"height": 141
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "1blU2OArJIfoC9XfupGxJG"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 19
},
"_enabled": true,
"_materials": [],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "6fbc30a8-3c49-44ae-8ba4-7f56f385b78a"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "03GEWUEZJGyKormWgIWCtM"
},
{
"__type__": "cc.Node",
"_name": "audio",
"_objFlags": 0,
"_parent": {
"__id__": 14
},
"_children": [
{
"__id__": 22
}
],
"_active": true,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "d9f+b0lmZGSJJae6zrADhp"
},
{
"__type__": "cc.Node",
"_name": "btn",
"_objFlags": 0,
"_parent": {
"__id__": 21
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 23
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "e87DSaFCVJfb2PAUkf4/o7"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 22
},
"_enabled": true,
"_clip": {
"__uuid__": "f0680ae0-c079-45ef-abd7-9e63d90b982b"
},
"_volume": 1,
"_mute": false,
"_loop": false,
"_firstlyEnabled": true,
"playOnLoad": false,
"preload": false,
"_id": "dey05oKrBIspvsDa6pOIQz"
},
{
"__type__": "cc.Canvas",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_designResolution": {
"__type__": "cc.Size",
"width": 1280,
"height": 720
},
"_fitWidth": true,
"_fitHeight": true,
"_id": "59Cd0ovbdF4byw5sbjJDx7"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "29zXboiXFBKoIV4PQ2liTe"
},
{
"__type__": "408a6f4ZfpM8Yzyg+IOGg/V",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_id": "eaTVUpqahPfZeO9+sUI7RP"
}
]
\ No newline at end of file
assets/cake/scene/cocos_generator.fire.meta
deleted
100644 → 0
View file @
05f8ab0c
{
"ver": "1.2.9",
"uuid": "0737ce42-24f0-45c6-8e1a-8bdab4f74ba3",
"asyncLoadAssets": false,
"autoReleaseAssets": true,
"subMetas": {}
}
\ No newline at end of file
assets/cake/scene/cocos_generator.ts
deleted
100644 → 0
View file @
05f8ab0c
import
{
asyncDelay
,
onHomeworkFinish
}
from
"
../script/util
"
;
import
{
MyCocosSceneComponent
}
from
"
../script/MyCocosSceneComponent
"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
export
default
class
SceneComponent
extends
MyCocosSceneComponent
{
addPreloadImage
()
{
// TODO 根据自己的配置预加载图片资源
this
.
_imageResList
.
push
({
url
:
this
.
data
.
pic_url
});
this
.
_imageResList
.
push
({
url
:
this
.
data
.
pic_url_2
});
}
addPreloadAudio
()
{
// TODO 根据自己的配置预加载音频资源
this
.
_audioResList
.
push
({
url
:
this
.
data
.
audio_url
});
}
addPreloadAnima
()
{
}
onLoadEnd
()
{
// TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考
this
.
initData
();
this
.
initView
();
this
.
initListener
();
}
_cantouch
=
null
;
initData
()
{
// 所有全局变量 默认都是null
this
.
_cantouch
=
true
;
}
initView
()
{
this
.
initBg
();
this
.
initPic
();
this
.
initBtn
();
this
.
initIcon
();
}
initBg
()
{
const
bgNode
=
cc
.
find
(
'
Canvas/bg
'
);
bgNode
.
scale
=
this
.
_mapScaleMax
;
}
pic1
=
null
;
pic2
=
null
;
initPic
()
{
const
canvas
=
cc
.
find
(
'
Canvas
'
);
const
maxW
=
canvas
.
width
*
0.7
;
this
.
getSprNodeByUrl
(
this
.
data
.
pic_url
,
(
sprNode
)
=>
{
const
picNode1
=
sprNode
;
picNode1
.
scale
=
maxW
/
picNode1
.
width
;
picNode1
.
baseX
=
picNode1
.
x
;
canvas
.
addChild
(
picNode1
);
this
.
pic1
=
picNode1
;
const
labelNode
=
new
cc
.
Node
();
labelNode
.
color
=
cc
.
Color
.
YELLOW
;
const
label
=
labelNode
.
addComponent
(
cc
.
Label
);
label
.
string
=
this
.
data
.
text
;
label
.
fontSize
=
60
;
label
.
lineHeight
=
60
;
label
.
font
=
cc
.
find
(
'
Canvas/res/font/BRLNSDB
'
).
getComponent
(
'
cc.Label
'
).
font
;
picNode1
.
addChild
(
labelNode
);
});
this
.
getSprNodeByUrl
(
this
.
data
.
pic_url_2
,
(
sprNode
)
=>
{
const
picNode2
=
sprNode
;
picNode2
.
scale
=
maxW
/
picNode2
.
width
;
canvas
.
addChild
(
picNode2
);
picNode2
.
x
=
canvas
.
width
;
picNode2
.
baseX
=
picNode2
.
x
;
this
.
pic2
=
picNode2
;
const
labelNode
=
new
cc
.
Node
();
const
label
=
labelNode
.
addComponent
(
cc
.
RichText
);
const
size
=
60
label
.
font
=
cc
.
find
(
'
Canvas/res/font/BRLNSDB
'
).
getComponent
(
cc
.
Label
).
font
;
label
.
string
=
`<outline color=#751e00 width=4><size=
${
size
}
><color=#ffffff>
${
this
.
data
.
text
}
</color></size></outline>`
label
.
lineHeight
=
size
;
picNode2
.
addChild
(
labelNode
);
});
}
initIcon
()
{
const
iconNode
=
this
.
getSprNode
(
'
icon
'
);
iconNode
.
zIndex
=
5
;
iconNode
.
anchorX
=
1
;
iconNode
.
anchorY
=
1
;
iconNode
.
parent
=
cc
.
find
(
'
Canvas
'
);
iconNode
.
x
=
iconNode
.
parent
.
width
/
2
-
10
;
iconNode
.
y
=
iconNode
.
parent
.
height
/
2
-
10
;
iconNode
.
on
(
cc
.
Node
.
EventType
.
TOUCH_START
,
()
=>
{
this
.
playAudioByUrl
(
this
.
data
.
audio_url
);
})
}
curPage
=
null
;
initBtn
()
{
this
.
curPage
=
0
;
const
bottomPart
=
cc
.
find
(
'
Canvas/bottomPart
'
);
bottomPart
.
zIndex
=
5
;
// 提高层级
bottomPart
.
x
=
bottomPart
.
parent
.
width
/
2
;
bottomPart
.
y
=
-
bottomPart
.
parent
.
height
/
2
;
const
leftBtnNode
=
bottomPart
.
getChildByName
(
'
btn_left
'
);
//节点中添加了button组件 则可以添加click事件监听
leftBtnNode
.
on
(
'
click
'
,
()
=>
{
if
(
!
this
.
_cantouch
)
{
return
;
}
if
(
this
.
curPage
==
0
)
{
return
;
}
this
.
curPage
=
0
this
.
leftMove
();
this
.
playLocalAudio
(
'
btn
'
);
})
const
rightBtnNode
=
bottomPart
.
getChildByName
(
'
btn_right
'
);
//节点中添加了button组件 则可以添加click事件监听
rightBtnNode
.
on
(
'
click
'
,
()
=>
{
if
(
!
this
.
_cantouch
)
{
return
;
}
if
(
this
.
curPage
==
1
)
{
return
;
}
this
.
curPage
=
1
this
.
rightMove
();
// 游戏结束时需要调用这个方法通知系统作业完成
onHomeworkFinish
();
this
.
playLocalAudio
(
'
btn
'
);
})
}
leftMove
()
{
this
.
_cantouch
=
false
;
const
len
=
this
.
pic1
.
parent
.
width
;
cc
.
tween
(
this
.
pic1
)
.
to
(
1
,
{
x
:
this
.
pic1
.
baseX
},
{
easing
:
'
cubicInOut
'
})
.
start
();
cc
.
tween
(
this
.
pic2
)
.
to
(
1
,
{
x
:
this
.
pic2
.
baseX
},
{
easing
:
'
cubicInOut
'
})
.
call
(()
=>
{
this
.
_cantouch
=
true
;
})
.
start
();
}
rightMove
()
{
this
.
_cantouch
=
false
;
const
len
=
this
.
pic1
.
parent
.
width
;
cc
.
tween
(
this
.
pic1
)
.
to
(
1
,
{
x
:
this
.
pic1
.
baseX
-
len
},
{
easing
:
'
cubicInOut
'
})
.
start
();
cc
.
tween
(
this
.
pic2
)
.
to
(
1
,
{
x
:
this
.
pic2
.
baseX
-
len
},
{
easing
:
'
cubicInOut
'
})
.
call
(()
=>
{
this
.
_cantouch
=
true
;
})
.
start
();
}
// update (dt) {},
initListener
()
{
}
playLocalAudio
(
audioName
)
{
const
audio
=
cc
.
find
(
`Canvas/res/audio/
${
audioName
}
`
).
getComponent
(
cc
.
AudioSource
);
return
new
Promise
((
resolve
,
reject
)
=>
{
const
id
=
cc
.
audioEngine
.
playEffect
(
audio
.
clip
,
false
);
cc
.
audioEngine
.
setFinishCallback
(
id
,
()
=>
{
resolve
(
id
);
});
})
}
}
assets/cake/scene/cocos_generator.ts.meta
deleted
100644 → 0
View file @
05f8ab0c
{
"ver": "1.0.8",
"uuid": "408a67f8-65fa-4cf1-8cf2-83e20e1a0fd5",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
assets/cake/textures/切图/test_nice_try.png.meta
View file @
c349b15f
...
...
@@ -4,9 +4,9 @@
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha":
fals
e,
"premultiplyAlpha":
tru
e,
"genMipmaps": false,
"packable":
tru
e,
"packable":
fals
e,
"width": 378,
"height": 192,
"platformSettings": {},
...
...
bin/buildCocos.js
View file @
c349b15f
const
{
spawn
}
=
require
(
"
child_process
"
);
const
fs
=
require
(
"
fs
"
);
const
{
spawn
}
=
require
(
'
child_process
'
);
const
fs
=
require
(
'
fs
'
);
const
compressing
=
require
(
'
compressing
'
);
const
{
v4
,
parse
}
=
require
(
'
uuid
'
);
const
{
Base64
}
=
require
(
'
js-base64
'
);
const
{
copyDir
,
removeDir
,
fix2
}
=
require
(
"
./utils
"
);
const
{
copyDir
,
removeDir
,
fix2
}
=
require
(
'
./utils
'
);
async
function
buildForm
()
{
const
paths
=
fs
.
readdirSync
(
'
form
'
);
...
...
@@ -30,11 +30,7 @@ async function buildForm() {
function
execCmd
(
cmd
,
params
,
path
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
buffer
=
spawn
(
cmd
,
params
,
{
cwd
:
path
}
);
const
buffer
=
spawn
(
cmd
,
params
,
{
cwd
:
path
});
buffer
.
stdout
.
on
(
'
data
'
,
(
data
)
=>
{
console
.
log
(
`stdout:
${
data
}
`
);
...
...
@@ -51,18 +47,13 @@ function execCmd(cmd, params, path) {
});
}
let
creatorBasePath
=
'
CocosCreator
'
;
let
creatorBasePath
=
'
D:/install/CocosDashboard_1.0.6/resources/.editors/Creator/2.4.5/CocosCreator.exe
'
;
if
(
process
.
platform
!==
'
win32
'
)
{
creatorBasePath
=
"
/Applications/CocosCreator/Creator/2.4.5/CocosCreator.app/Contents/MacOS/CocosCreator
"
;
creatorBasePath
=
'
/Applications/CocosCreator/Creator/2.4.5/CocosCreator.app/Contents/MacOS/CocosCreator
'
;
}
const
buildCocos
=
function
(
args
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
buffer
=
spawn
(
creatorBasePath
,
args
,
{
cwd
:
'
.
'
}
);
const
buffer
=
spawn
(
creatorBasePath
,
args
,
{
cwd
:
'
.
'
});
buffer
.
stdout
.
on
(
'
data
'
,
(
data
)
=>
{
console
.
log
(
`stdout:
${
data
}
`
);
...
...
@@ -88,7 +79,7 @@ function getReleaseFileName(projectName) {
function
getFolderName
(
path
)
{
let
folderName
=
''
;
fs
.
readdirSync
(
path
).
find
(
fileName
=>
{
fs
.
readdirSync
(
path
).
find
((
fileName
)
=>
{
const
st
=
fs
.
statSync
(
`
${
path
}
/
${
fileName
}
`
);
if
(
st
.
isDirectory
())
{
folderName
=
fileName
;
...
...
@@ -103,7 +94,7 @@ function editFolderMeta(path, folderName, isBundle) {
metaData
.
isBundle
=
isBundle
;
metaData
.
isRemoteBundle
=
{
ios
:
isBundle
,
android
:
isBundle
android
:
isBundle
,
};
fs
.
writeFileSync
(
metaPath
,
JSON
.
stringify
(
metaData
));
}
...
...
@@ -119,52 +110,52 @@ async function buildAndroidBundle() {
}
async
function
buildIosBundle
()
{
const
args
=
[
'
--path
'
,
'
./
'
,
'
--build
'
,
"
platform=ios;debug=false;md5Cache=true;buildPath=build_ios;encryptJs=true;xxteaKey=6bbfce23-28b4-4a;zipCompressJs=true
"
,
'
--force
'
];
const
args
=
[
'
--path
'
,
'
./
'
,
'
--build
'
,
'
platform=ios;debug=false;md5Cache=true;buildPath=build_ios;encryptJs=true;xxteaKey=6bbfce23-28b4-4a;zipCompressJs=true
'
,
'
--force
'
];
await
buildCocos
(
args
);
}
async
function
buildWebBundle
()
{
const
args
=
[
'
--path
'
,
'
./
'
,
'
--build
'
,
"
platform=web-desktop;debug=false;buildPath=build_web_desktop
"
,
'
--force
'
];
const
args
=
[
'
--path
'
,
'
./
'
,
'
--build
'
,
'
platform=web-desktop;debug=false;buildPath=build_web_desktop
'
,
'
--force
'
];
await
buildCocos
(
args
);
}
function
createConfigFile
(
projectName
,
type
)
{
let
iosVersion
=
""
;
let
androidVersion
=
""
;
if
(
!
type
)
{
function
createConfigFile
(
projectName
,
type
)
{
let
iosVersion
=
''
;
let
androidVersion
=
''
;
if
(
!
type
)
{
const
androidPaths
=
fs
.
readdirSync
(
`dist/android/
${
projectName
}
`
);
const
androidConfigFileName
=
androidPaths
.
find
(
path
=>
path
.
indexOf
(
'
config
'
)
==
0
);
const
androidConfigFileName
=
androidPaths
.
find
((
path
)
=>
path
.
indexOf
(
'
config
'
)
==
0
);
androidVersion
=
androidConfigFileName
.
split
(
'
.
'
)[
1
];
const
iosPaths
=
fs
.
readdirSync
(
`dist/ios/
${
projectName
}
`
);
const
iosConfigFileName
=
iosPaths
.
find
(
path
=>
path
.
indexOf
(
'
config
'
)
==
0
);
const
iosConfigFileName
=
iosPaths
.
find
((
path
)
=>
path
.
indexOf
(
'
config
'
)
==
0
);
iosVersion
=
iosConfigFileName
.
split
(
'
.
'
)[
1
];
}
else
{
if
(
type
==
"
android
"
)
{
if
(
type
==
'
android
'
)
{
const
androidPaths
=
fs
.
readdirSync
(
`dist/android/
${
projectName
}
`
);
const
androidConfigFileName
=
androidPaths
.
find
(
path
=>
path
.
indexOf
(
'
config
'
)
==
0
);
const
androidConfigFileName
=
androidPaths
.
find
((
path
)
=>
path
.
indexOf
(
'
config
'
)
==
0
);
androidVersion
=
androidConfigFileName
.
split
(
'
.
'
)[
1
];
}
else
{
}
else
{
const
iosPaths
=
fs
.
readdirSync
(
`dist/ios/
${
projectName
}
`
);
const
iosConfigFileName
=
iosPaths
.
find
(
path
=>
path
.
indexOf
(
'
config
'
)
==
0
);
const
iosConfigFileName
=
iosPaths
.
find
((
path
)
=>
path
.
indexOf
(
'
config
'
)
==
0
);
iosVersion
=
iosConfigFileName
.
split
(
'
.
'
)[
1
];
}
}
const
config
=
{
"
ios
"
:
{
"
sceneName
"
:
projectName
,
"
version
"
:
iosVersion
ios
:
{
sceneName
:
projectName
,
version
:
iosVersion
,
},
"
android
"
:
{
"
sceneName
"
:
projectName
,
"
version
"
:
androidVersion
}
}
android
:
{
sceneName
:
projectName
,
version
:
androidVersion
,
},
};
fs
.
writeFileSync
(
'
dist/config.json
'
,
JSON
.
stringify
(
config
));
}
function
compressAll
(
projectName
)
{
function
compressAll
(
projectName
)
{
const
tarStream
=
new
compressing
.
zip
.
Stream
();
tarStream
.
addEntry
(
'
dist/play
'
);
tarStream
.
addEntry
(
'
dist/form
'
);
...
...
@@ -176,12 +167,12 @@ function compressAll (projectName) {
tarStream
.
pipe
(
destStream
);
}
function
build_check
()
{
function
build_check
()
{
const
dirNames
=
process
.
cwd
().
split
(
/
\/
|
\\
/
);
const
projectName
=
dirNames
[
dirNames
.
length
-
1
];
const
path
=
'
assets
'
const
path
=
'
assets
'
;
let
folderName
=
''
;
fs
.
readdirSync
(
path
).
find
(
fileName
=>
{
fs
.
readdirSync
(
path
).
find
((
fileName
)
=>
{
const
st
=
fs
.
statSync
(
`
${
path
}
/
${
fileName
}
`
);
if
(
st
.
isDirectory
())
{
folderName
=
fileName
;
...
...
@@ -189,11 +180,11 @@ function build_check () {
});
if
(
projectName
!=
folderName
)
{
throw
(
`项目名(
${
projectName
}
)与bundle文件夹名(
${
folderName
}
)不相同`
)
;
throw
`项目名(
${
projectName
}
)与bundle文件夹名(
${
folderName
}
)不相同`
;
}
let
same
=
false
;
const
files
=
fs
.
readdirSync
(
`
${
path
}
/
${
folderName
}
/scene`
);
files
.
forEach
(
fileName
=>
{
files
.
forEach
((
fileName
)
=>
{
fileName
.
split
(
'
.
'
).
forEach
((
str
,
idx
,
arr
)
=>
{
if
(
str
==
'
fire
'
)
{
const
sceneName
=
arr
[
idx
-
1
];
...
...
@@ -201,36 +192,35 @@ function build_check () {
same
=
true
;
}
}
})
});
});
if
(
!
same
)
{
throw
(
`bundle文件夹名称(
${
folderName
}
)与scene名称不相同`
)
;
throw
`bundle文件夹名称(
${
folderName
}
)与scene名称不相同`
;
}
return
projectName
;
}
function
changeSettingToWebDesktop
()
{
const
path
=
'
assets
'
function
changeSettingToWebDesktop
()
{
const
path
=
'
assets
'
;
const
folderName
=
getFolderName
(
path
);
editFolderMeta
(
path
,
folderName
,
false
);
}
function
changeSettingsToBundle
()
{
const
path
=
'
assets
'
function
changeSettingsToBundle
()
{
const
path
=
'
assets
'
;
const
folderName
=
getFolderName
(
path
);
editFolderMeta
(
path
,
folderName
,
true
);
}
function
replaceUuids
()
{
function
replaceUuids
()
{
console
.
log
(
'
build_step_0 开始~!
'
);
const
path
=
'
assets
'
const
path
=
'
assets
'
;
function
getFolderName
(
path
)
{
let
folderName
=
''
;
fs
.
readdirSync
(
path
).
find
(
fileName
=>
{
fs
.
readdirSync
(
path
).
find
((
fileName
)
=>
{
const
st
=
fs
.
statSync
(
`
${
path
}
/
${
fileName
}
`
);
if
(
st
.
isDirectory
())
{
folderName
=
fileName
;
...
...
@@ -276,7 +266,7 @@ function replaceUuids () {
}
const
fileStr
=
fs
.
readFileSync
(
path
);
const
newFileStr
=
fileStr
.
toString
().
replace
(
new
RegExp
(
replaceStr
.
replace
(
/
[
.*+?^${}()|[
\]\\]
/g
,
"
\\
$&
"
),
'
g
'
),
newStr
);
const
newFileStr
=
fileStr
.
toString
().
replace
(
new
RegExp
(
replaceStr
.
replace
(
/
[
.*+?^${}()|[
\]\\]
/g
,
'
\\
$&
'
),
'
g
'
),
newStr
);
fs
.
writeFileSync
(
path
,
newFileStr
);
}
function
getShortUuid
(
uuid
)
{
...
...
@@ -303,15 +293,13 @@ function replaceUuids () {
console
.
log
(
'
build_step_0 完成~!
'
);
}
function
replaceIndexHtml
()
{
function
replaceIndexHtml
()
{
const
data
=
fs
.
readFileSync
(
'
index.html
'
);
fs
.
writeFileSync
(
'
dist/play/index.html
'
,
data
);
}
module
.
exports
=
{
build
:
async
function
()
{
const
startTime
=
new
Date
().
getTime
();
// 构建前检查
...
...
@@ -373,7 +361,6 @@ module.exports = {
},
buildAndroid
:
async
function
()
{
// 构建前检查
const
projectName
=
build_check
();
// 替换uuid
...
...
@@ -387,13 +374,12 @@ module.exports = {
// 改设置为非bundle
changeSettingToWebDesktop
();
createConfigFile
(
projectName
,
"
android
"
);
createConfigFile
(
projectName
,
'
android
'
);
await
removeDir
(
'
build_android
'
);
console
.
log
(
'
构建 android bundle 成功!
'
);
},
buildIos
:
async
function
()
{
// 构建前检查
const
projectName
=
build_check
();
// 替换uuid
...
...
@@ -407,9 +393,8 @@ module.exports = {
// 改设置为非bundle
changeSettingToWebDesktop
();
createConfigFile
(
projectName
,
"
ios
"
);
createConfigFile
(
projectName
,
'
ios
'
);
await
removeDir
(
'
build_ios
'
);
console
.
log
(
'
构建 ios bundle 成功!
'
);
}
},
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment