Commit c349b15f authored by 李帅's avatar 李帅

优化完成

parent 05f8ab0c
{
"ver": "1.1.2",
"uuid": "c35bb2f6-f24a-4850-ae44-643f2fdc7541",
"isBundle": true,
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {
"ios": true,
"android": true
"ios": false,
"android": false
},
"subMetas": {}
}
\ No newline at end of file
......@@ -87,25 +87,22 @@
"__id__": 15
},
{
"__id__": 38
},
{
"__id__": 87
"__id__": 36
},
{
"__id__": 94
"__id__": 89
},
{
"__id__": 107
"__id__": 96
},
{
"__id__": 109
},
{
"__id__": 120
"__id__": 111
},
{
"__id__": 123
"__id__": 122
},
{
"__id__": 125
......@@ -121,18 +118,21 @@
},
{
"__id__": 133
},
{
"__id__": 135
}
],
"_active": true,
"_components": [
{
"__id__": 159
"__id__": 161
},
{
"__id__": 160
"__id__": 162
},
{
"__id__": 161
"__id__": 163
}
],
"_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__": 19
"__id__": 17
},
{
"__id__": 21
"__id__": 19
},
{
"__id__": 24
"__id__": 22
}
],
"_active": false,
"_components": [
{
"__id__": 26
"__id__": 24
},
{
"__id__": 27
"__id__": 25
}
],
"_prefab": null,
......@@ -1019,13 +914,13 @@
"_name": "side",
"_objFlags": 0,
"_parent": {
"__id__": 18
"__id__": 16
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 20
"__id__": 18
}
],
"_prefab": null,
......@@ -1081,7 +976,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 19
"__id__": 17
},
"_enabled": true,
"_materials": [
......@@ -1113,16 +1008,16 @@
"_name": "label",
"_objFlags": 0,
"_parent": {
"__id__": 18
"__id__": 16
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 22
"__id__": 20
},
{
"__id__": 23
"__id__": 21
}
],
"_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__": 18
"__id__": 16
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 25
"__id__": 23
}
],
"_prefab": null,
......@@ -1291,7 +1186,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 24
"__id__": 22
},
"_enabled": true,
"_materials": [
......@@ -1331,7 +1226,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 18
"__id__": 16
},
"_enabled": true,
"_materials": [
......@@ -1363,7 +1258,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 18
"__id__": 16
},
"_enabled": true,
"_normalMaterial": null,
......@@ -1435,22 +1330,22 @@
},
"_children": [
{
"__id__": 29
"__id__": 27
},
{
"__id__": 31
"__id__": 29
},
{
"__id__": 34
"__id__": 32
}
],
"_active": false,
"_components": [
{
"__id__": 36
"__id__": 34
},
{
"__id__": 37
"__id__": 35
}
],
"_prefab": null,
......@@ -1506,13 +1401,13 @@
"_name": "side",
"_objFlags": 0,
"_parent": {
"__id__": 28
"__id__": 26
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 30
"__id__": 28
}
],
"_prefab": null,
......@@ -1568,7 +1463,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 29
"__id__": 27
},
"_enabled": true,
"_materials": [
......@@ -1600,16 +1495,16 @@
"_name": "label",
"_objFlags": 0,
"_parent": {
"__id__": 28
"__id__": 26
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 32
"__id__": 30
},
{
"__id__": 33
"__id__": 31
}
],
"_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__": 28
"__id__": 26
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 35
"__id__": 33
}
],
"_prefab": null,
......@@ -1780,7 +1675,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 34
"__id__": 32
},
"_enabled": true,
"_materials": [
......@@ -1820,7 +1715,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 28
"__id__": 26
},
"_enabled": true,
"_materials": [
......@@ -1852,7 +1747,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 28
"__id__": 26
},
"_enabled": true,
"_normalMaterial": null,
......@@ -1924,10 +1819,10 @@
},
"_children": [
{
"__id__": 39
"__id__": 37
},
{
"__id__": 41
"__id__": 39
},
{
"__id__": 82
......@@ -1988,13 +1883,13 @@
"_name": "desktop",
"_objFlags": 0,
"_parent": {
"__id__": 38
"__id__": 36
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 40
"__id__": 38
}
],
"_prefab": null,
......@@ -2050,7 +1945,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 39
"__id__": 37
},
"_enabled": true,
"_materials": [
......@@ -2082,9 +1977,12 @@
"_name": "cake",
"_objFlags": 0,
"_parent": {
"__id__": 38
"__id__": 36
},
"_children": [
{
"__id__": 40
},
{
"__id__": 42
},
......@@ -2154,12 +2052,114 @@
"groupIndex": 0,
"_id": "49XmekaW1Ei7T8Owod6JBy"
},
{
"__type__": "cc.Node",
"_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__": 41
"__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__": 38
"__id__": 36
},
"_children": [
{
......@@ -4101,11 +4101,77 @@
"_parent": {
"__id__": 82
},
"_children": [],
"_children": [
{
"__id__": 86
}
],
"_active": true,
"_components": [
{
"__id__": 86
"__id__": 88
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 789,
"height": 492
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
345,
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": "6dTLynhYZO+aX8+jBftAUg"
},
{
"__type__": "cc.Node",
"_name": "btn_replay",
"_objFlags": 0,
"_parent": {
"__id__": 85
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 87
}
],
"_prefab": null,
......@@ -4119,8 +4185,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 789,
"height": 492
"width": 1280,
"height": 720
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -4132,14 +4198,14 @@
"ctor": "Float64Array",
"array": [
0,
345,
0,
0,
0,
0,
0,
1,
1,
1,
2,
2,
1
]
},
......@@ -4154,7 +4220,75 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "6dTLynhYZO+aX8+jBftAUg"
"_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__": 87
"__id__": 89
},
"_children": [
{
"__id__": 89
"__id__": 91
},
{
"__id__": 91
"__id__": 93
}
],
"_active": false,
"_components": [
{
"__id__": 93
"__id__": 95
}
],
"_prefab": null,
......@@ -4324,13 +4458,13 @@
"_name": "cake_timeout_ske",
"_objFlags": 0,
"_parent": {
"__id__": 88
"__id__": 90
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 90
"__id__": 92
}
],
"_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__": 92
"__id__": 94
}
],
"_prefab": null,
......@@ -4488,7 +4622,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 91
"__id__": 93
},
"_enabled": true,
"_materials": [
......@@ -4528,7 +4662,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 88
"__id__": 90
},
"_enabled": true,
"_materials": [
......@@ -4564,13 +4698,13 @@
},
"_children": [
{
"__id__": 95
"__id__": 97
},
{
"__id__": 98
"__id__": 100
},
{
"__id__": 105
"__id__": 107
}
],
"_active": true,
......@@ -4628,16 +4762,16 @@
"_name": "btn_submit",
"_objFlags": 0,
"_parent": {
"__id__": 94
"__id__": 96
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 96
"__id__": 98
},
{
"__id__": 97
"__id__": 99
}
],
"_prefab": null,
......@@ -4693,7 +4827,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 95
"__id__": 97
},
"_enabled": true,
"_materials": [
......@@ -4725,7 +4859,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 95
"__id__": 97
},
"_enabled": true,
"_normalMaterial": null,
......@@ -4793,23 +4927,23 @@
"_name": "btn_sound",
"_objFlags": 0,
"_parent": {
"__id__": 94
"__id__": 96
},
"_children": [
{
"__id__": 99
"__id__": 101
},
{
"__id__": 101
"__id__": 103
}
],
"_active": false,
"_components": [
{
"__id__": 103
"__id__": 105
},
{
"__id__": 104
"__id__": 106
}
],
"_prefab": null,
......@@ -4865,13 +4999,13 @@
"_name": "close",
"_objFlags": 0,
"_parent": {
"__id__": 98
"__id__": 100
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 100
"__id__": 102
}
],
"_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__": 102
"__id__": 104
}
],
"_prefab": null,
......@@ -5021,7 +5155,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 101
"__id__": 103
},
"_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__": 94
"__id__": 96
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 106
"__id__": 108
}
],
"_prefab": null,
......@@ -5215,7 +5349,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 105
"__id__": 107
},
"_enabled": true,
"_materials": [
......@@ -5253,7 +5387,7 @@
"_active": false,
"_components": [
{
"__id__": 108
"__id__": 110
}
],
"_prefab": null,
......@@ -5309,7 +5443,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 107
"__id__": 109
},
"_enabled": true,
"_materials": [
......@@ -5345,10 +5479,10 @@
},
"_children": [
{
"__id__": 110
"__id__": 112
},
{
"__id__": 112
"__id__": 114
}
],
"_active": true,
......@@ -5406,13 +5540,13 @@
"_name": "layout",
"_objFlags": 0,
"_parent": {
"__id__": 109
"__id__": 111
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 111
"__id__": 113
}
],
"_prefab": null,
......@@ -5468,7 +5602,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 110
"__id__": 112
},
"_enabled": true,
"_layoutSize": {
......@@ -5500,23 +5634,23 @@
"_name": "item",
"_objFlags": 0,
"_parent": {
"__id__": 109
"__id__": 111
},
"_children": [
{
"__id__": 113
},
{
"__id__": 115
},
{
"__id__": 117
},
{
"__id__": 119
}
],
"_active": false,
"_components": [
{
"__id__": 119
"__id__": 121
}
],
"_prefab": null,
......@@ -5572,13 +5706,13 @@
"_name": "bule",
"_objFlags": 0,
"_parent": {
"__id__": 112
"__id__": 114
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 114
"__id__": 116
}
],
"_prefab": null,
......@@ -5634,7 +5768,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 113
"__id__": 115
},
"_enabled": true,
"_materials": [
......@@ -5666,13 +5800,13 @@
"_name": "red",
"_objFlags": 0,
"_parent": {
"__id__": 112
"__id__": 114
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 116
"__id__": 118
}
],
"_prefab": null,
......@@ -5728,7 +5862,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 115
"__id__": 117
},
"_enabled": true,
"_materials": [
......@@ -5760,13 +5894,13 @@
"_name": "tag",
"_objFlags": 0,
"_parent": {
"__id__": 112
"__id__": 114
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 118
"__id__": 120
}
],
"_prefab": null,
......@@ -5822,7 +5956,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 117
"__id__": 119
},
"_enabled": true,
"_materials": [
......@@ -5854,7 +5988,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 112
"__id__": 114
},
"_enabled": true,
"_materials": [
......@@ -5892,10 +6026,10 @@
"_active": false,
"_components": [
{
"__id__": 121
"__id__": 123
},
{
"__id__": 122
"__id__": 124
}
],
"_prefab": null,
......@@ -5951,7 +6085,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 120
"__id__": 122
},
"_enabled": true,
"_materials": [
......@@ -5983,7 +6117,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 120
"__id__": 122
},
"_enabled": true,
"_normalMaterial": null,
......@@ -6057,7 +6191,7 @@
"_active": false,
"_components": [
{
"__id__": 124
"__id__": 126
}
],
"_prefab": null,
......@@ -6113,7 +6247,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 123
"__id__": 125
},
"_enabled": true,
"_materials": [
......@@ -6159,7 +6293,7 @@
"_active": false,
"_components": [
{
"__id__": 126
"__id__": 128
}
],
"_prefab": null,
......@@ -6215,7 +6349,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 125
"__id__": 127
},
"_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__": 128
"__id__": 130
}
],
"_prefab": null,
......@@ -6309,7 +6443,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 127
"__id__": 129
},
"_enabled": true,
"_materials": [
......@@ -6347,7 +6481,7 @@
"_active": false,
"_components": [
{
"__id__": 130
"__id__": 132
}
],
"_prefab": null,
......@@ -6403,7 +6537,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 129
"__id__": 131
},
"_enabled": true,
"_materials": [
......@@ -6441,7 +6575,7 @@
"_active": false,
"_components": [
{
"__id__": 132
"__id__": 134
}
],
"_prefab": null,
......@@ -6497,7 +6631,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 131
"__id__": 133
},
"_enabled": true,
"_materials": [
......@@ -6541,13 +6675,13 @@
},
"_children": [
{
"__id__": 134
"__id__": 136
},
{
"__id__": 137
"__id__": 139
},
{
"__id__": 142
"__id__": 144
}
],
"_active": false,
......@@ -6605,11 +6739,11 @@
"_name": "font",
"_objFlags": 0,
"_parent": {
"__id__": 133
"__id__": 135
},
"_children": [
{
"__id__": 135
"__id__": 137
}
],
"_active": true,
......@@ -6667,13 +6801,13 @@
"_name": "BRLNSDB",
"_objFlags": 0,
"_parent": {
"__id__": 134
"__id__": 136
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 136
"__id__": 138
}
],
"_prefab": null,
......@@ -6729,7 +6863,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 135
"__id__": 137
},
"_enabled": true,
"_materials": [],
......@@ -6760,14 +6894,14 @@
"_name": "img",
"_objFlags": 0,
"_parent": {
"__id__": 133
"__id__": 135
},
"_children": [
{
"__id__": 138
"__id__": 140
},
{
"__id__": 140
"__id__": 142
}
],
"_active": true,
......@@ -6825,13 +6959,13 @@
"_name": "candle_select",
"_objFlags": 0,
"_parent": {
"__id__": 137
"__id__": 139
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 139
"__id__": 141
}
],
"_prefab": null,
......@@ -6887,7 +7021,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 138
"__id__": 140
},
"_enabled": true,
"_materials": [],
......@@ -6915,13 +7049,13 @@
"_name": "candle_test",
"_objFlags": 0,
"_parent": {
"__id__": 137
"__id__": 139
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 141
"__id__": 143
}
],
"_prefab": null,
......@@ -6977,7 +7111,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 140
"__id__": 142
},
"_enabled": true,
"_materials": [],
......@@ -7005,12 +7139,9 @@
"_name": "audio",
"_objFlags": 0,
"_parent": {
"__id__": 133
"__id__": 135
},
"_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__": 142
"__id__": 144
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 144
"__id__": 146
}
],
"_prefab": null,
......@@ -7150,7 +7284,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 143
"__id__": 145
},
"_enabled": true,
"_clip": {
......@@ -7169,13 +7303,13 @@
"_name": "right",
"_objFlags": 0,
"_parent": {
"__id__": 142
"__id__": 144
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 146
"__id__": 148
}
],
"_prefab": null,
......@@ -7231,7 +7365,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 145
"__id__": 147
},
"_enabled": true,
"_clip": {
......@@ -7250,13 +7384,13 @@
"_name": "voice_test_nice_try",
"_objFlags": 0,
"_parent": {
"__id__": 142
"__id__": 144
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 148
"__id__": 150
}
],
"_prefab": null,
......@@ -7312,7 +7446,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 147
"__id__": 149
},
"_enabled": true,
"_clip": {
......@@ -7331,13 +7465,13 @@
"_name": "voice_test_excellent",
"_objFlags": 0,
"_parent": {
"__id__": 142
"__id__": 144
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 150
"__id__": 152
}
],
"_prefab": null,
......@@ -7393,7 +7527,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 149
"__id__": 151
},
"_enabled": true,
"_clip": {
......@@ -7412,13 +7546,13 @@
"_name": "error",
"_objFlags": 0,
"_parent": {
"__id__": 142
"__id__": 144
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 152
"__id__": 154
}
],
"_prefab": null,
......@@ -7474,7 +7608,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 151
"__id__": 153
},
"_enabled": true,
"_clip": {
......@@ -7493,13 +7627,13 @@
"_name": "game_over_came_on",
"_objFlags": 0,
"_parent": {
"__id__": 142
"__id__": 144
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 154
"__id__": 156
}
],
"_prefab": null,
......@@ -7555,7 +7689,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 153
"__id__": 155
},
"_enabled": true,
"_clip": {
......@@ -7574,13 +7708,13 @@
"_name": "game_over_nice_try",
"_objFlags": 0,
"_parent": {
"__id__": 142
"__id__": 144
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 156
"__id__": 158
}
],
"_prefab": null,
......@@ -7636,7 +7770,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 155
"__id__": 157
},
"_enabled": true,
"_clip": {
......@@ -7655,13 +7789,13 @@
"_name": "all_right",
"_objFlags": 0,
"_parent": {
"__id__": 142
"__id__": 144
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 158
"__id__": 160
}
],
"_prefab": null,
......@@ -7717,7 +7851,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 157
"__id__": 159
},
"_enabled": true,
"_clip": {
......
/*
* @Author: ls
* @Date: 2022-03-09 21:15:44
* @LastEditTime: 2022-03-15 11:50:32
* @LastEditTime: 2022-03-15 17: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,128 +483,138 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.initGame();
}
startTest() {
// TODO 结束录音
// TODO 开始测评
// window['courseware'].startTest();
this.stopTest();
// 渐显遮罩
let mask = cc.find('mask', this.node);
mask.opacity = 0;
mask.active = true;
cc.Tween.stopAllByTarget(mask);
cc.tween(mask).to(0.5, { opacity: 255 }).start();
startTest(value) {
// 开始系统评测
window['courseware'].startTest(value);
}
// TODO 文档未体现 移除蜡烛和提交
// 移出提交
let submit = cc.find('right_down/btn_submit', this.node);
submit.off('click');
// submit.x = -120;
submit.active = true;
cc.Tween.stopAllByTarget(submit);
cc.tween(submit)
.to(0.5, { x: 120 })
.call(() => {
submit.active = false;
})
.start();
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);
mask.opacity = 0;
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);
submit.off('click');
// submit.x = -120;
submit.active = true;
cc.Tween.stopAllByTarget(submit);
cc.tween(submit)
.to(0.5, { x: 120 })
.call(() => {
submit.active = false;
})
.start();
// 移除蜡烛燃烧回调
if (this._schedule_candle) {
this._timeout = 0;
this.unschedule(this._schedule_candle);
this._schedule_candle = null; // 移除蜡烛 schedule
}
// 移出蜡烛
let candle = cc.find('left_down/candle', this.node);
candle.active = true;
// candle.x = 80;
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);
this.playLocalAudio('voice_test_nice_try');
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('tag').active = false;
curTag.getChildByName('red').active = true;
// 移除蜡烛燃烧回调
if (this._schedule_candle) {
this._timeout = 0;
this.unschedule(this._schedule_candle);
this._schedule_candle = null; // 移除蜡烛 schedule
}
let winSizeH = this.node.height;
// 移出蜡烛
let candle = cc.find('left_down/candle', this.node);
candle.active = true;
// candle.x = 80;
cc.Tween.stopAllByTarget(candle);
cc.tween(candle).to(0.5, { x: -80 }).start();
res = JSON.parse(res);
if (res['result'].overall < 80) {
this._results[this._curPage] = false;
// 移入测评nice try
let test_nice_try = cc.find('test_nice_try', this.node);
this.playLocalAudio('voice_test_nice_try');
cc.Tween.stopAllByTarget(test_nice_try);
test_nice_try.x = 0;
test_nice_try.y = winSizeH * 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' })
.call(() => {
test_nice_try.active = true;
})
.start();
let layout = cc.find('right_up/layout', this.node);
layout.active = true;
let curTag = layout.children[this._curPage];
// cc.Tween.stopAllByTarget(test_nice_try);
// cc.tween(test_nice_try)
// .to(0.5, { y: -winSizeH * 0.1 }, { easing: 'sineIn' })
// .to(0.2, { y: 0 }, { easing: 'sineOut' })
// .delay(1)
// .to(0.3, { y: -winSizeH * 0.5 - 400 }, { easing: 'sineIn' })
// .call(() => {
// test_nice_try.active = true;
// })
// .start();
}, 3000);
}
if (curTag) {
curTag.getChildByName('bule').active = false;
curTag.getChildByName('tag').active = false;
curTag.getChildByName('red').active = true;
}
// 移入测评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 = 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: -this.node.height * 0.5 - 400 }, { easing: 'sineIn' })
.call(() => {
test_nice_try.active = false;
})
.start();
stopTest() {
// window['courseware'].stopTest((res) => {
// console.log(res);
// console.log(res.overall);
// });
// cc.tween(test_nice_try)
// .to(0.5, { y: -this.node.height * 0.1 }, { easing: 'sineIn' })
// .to(0.2, { y: 0 }, { easing: 'sineOut' })
// .delay(1)
// .to(0.3, { y: -this.node.height * 0.5 - 400 }, { easing: 'sineIn' })
// .call(() => {
// test_nice_try.active = true;
// })
// .start();
} else {
this._results[this._curPage] = true;
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.startTest();
console.log('蜡烛燃尽');
self.stopTest();
} 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 < 0.6) {
this.comeOn();
if (numRight === this._results.length) {
this.allRight();
} else {
this.niceTry();
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;
......
[
{
"__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
{
"ver": "1.2.9",
"uuid": "0737ce42-24f0-45c6-8e1a-8bdab4f74ba3",
"asyncLoadAssets": false,
"autoReleaseAssets": true,
"subMetas": {}
}
\ No newline at end of file
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);
});
})
}
}
{
"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
......@@ -4,9 +4,9 @@
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"premultiplyAlpha": true,
"genMipmaps": false,
"packable": true,
"packable": false,
"width": 378,
"height": 192,
"platformSettings": {},
......
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 { 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');
async function buildForm() {
const paths = fs.readdirSync('form');
if (!paths.includes('tsconfig.json')) {
await copyDir('form', 'dist/form');
return;
}
if (process.platform == 'win32') {
await execCmd('npm.cmd', ['install'], 'form');
} else {
await execCmd('npm', ['install'], 'form');
}
if (process.platform == 'win32') {
await execCmd('npm.cmd', ['run', 'publish'], 'form');
} else {
await execCmd('npm', ['run', 'publish'], 'form');
}
await compressing.zip.uncompress('form/publish/form.zip', 'dist/form');
const paths = fs.readdirSync('form');
if (!paths.includes('tsconfig.json')) {
await copyDir('form', 'dist/form');
return;
}
if (process.platform == 'win32') {
await execCmd('npm.cmd', ['install'], 'form');
} else {
await execCmd('npm', ['install'], 'form');
}
if (process.platform == 'win32') {
await execCmd('npm.cmd', ['run', 'publish'], 'form');
} else {
await execCmd('npm', ['run', 'publish'], 'form');
}
await compressing.zip.uncompress('form/publish/form.zip', 'dist/form');
}
function execCmd(cmd, params, path) {
return new Promise((resolve, reject) => {
const buffer = spawn(
cmd,
params,
{ cwd: path }
);
buffer.stdout.on('data', (data) => {
console.log(`stdout: ${data}`);
});
buffer.stderr.on('data', (data) => {
console.error(`stderr: ${data}`);
});
buffer.on('close', (code) => {
console.log(`child process exited with code ${code}`);
resolve();
});
});
return new Promise((resolve, reject) => {
const buffer = spawn(cmd, params, { cwd: path });
buffer.stdout.on('data', (data) => {
console.log(`stdout: ${data}`);
});
buffer.stderr.on('data', (data) => {
console.error(`stderr: ${data}`);
});
buffer.on('close', (code) => {
console.log(`child process exited with code ${code}`);
resolve();
});
});
}
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: '.' }
);
buffer.stdout.on('data', (data) => {
console.log(`stdout: ${data}`);
});
buffer.stderr.on('data', (data) => {
console.error(`stderr: ${data}`);
});
buffer.on('close', (code) => {
console.log(`child process exited with code ${code}`);
resolve();
});
});
return new Promise((resolve, reject) => {
const buffer = spawn(creatorBasePath, args, { cwd: '.' });
buffer.stdout.on('data', (data) => {
console.log(`stdout: ${data}`);
});
buffer.stderr.on('data', (data) => {
console.error(`stderr: ${data}`);
});
buffer.on('close', (code) => {
console.log(`child process exited with code ${code}`);
resolve();
});
});
};
function getReleaseFileName(projectName) {
let date = new Date();
let fileName = `${projectName}_${date.getFullYear()}${fix2(date.getMonth() + 1)}${fix2(date.getDate())} `;
fileName += `${fix2(date.getHours())}-${fix2(date.getMinutes())}-${fix2(date.getSeconds())}`;
return fileName;
let date = new Date();
let fileName = `${projectName}_${date.getFullYear()}${fix2(date.getMonth() + 1)}${fix2(date.getDate())} `;
fileName += `${fix2(date.getHours())}-${fix2(date.getMinutes())}-${fix2(date.getSeconds())}`;
return fileName;
}
function getFolderName(path) {
let folderName = '';
fs.readdirSync(path).find(fileName => {
const st = fs.statSync(`${path}/${fileName}`);
if (st.isDirectory()) {
folderName = fileName;
}
});
return folderName;
let folderName = '';
fs.readdirSync(path).find((fileName) => {
const st = fs.statSync(`${path}/${fileName}`);
if (st.isDirectory()) {
folderName = fileName;
}
});
return folderName;
}
function editFolderMeta(path, folderName, isBundle) {
const metaPath = `${path}/${folderName}.meta`;
const metaDataStr = fs.readFileSync(metaPath);
const metaData = JSON.parse(metaDataStr);
metaData.isBundle = isBundle;
metaData.isRemoteBundle = {
ios: isBundle,
android: isBundle
};
fs.writeFileSync(metaPath, JSON.stringify(metaData));
const metaPath = `${path}/${folderName}.meta`;
const metaDataStr = fs.readFileSync(metaPath);
const metaData = JSON.parse(metaDataStr);
metaData.isBundle = isBundle;
metaData.isRemoteBundle = {
ios: isBundle,
android: isBundle,
};
fs.writeFileSync(metaPath, JSON.stringify(metaData));
}
async function buildWebDesktop() {
const args = ['--path', './', '--build', 'platform=web-desktop;debug=true', '--force'];
await buildCocos(args);
const args = ['--path', './', '--build', 'platform=web-desktop;debug=true', '--force'];
await buildCocos(args);
}
async function buildAndroidBundle() {
const args = ['--path', './', '--build', "platform=ios;debug=false;md5Cache=true;buildPath=build_android;appABIs=['armeabi-v7a','x86','x86_64','arm64-v8a'];encryptJs=true;xxteaKey=6bbfce23-28b4-4a;zipCompressJs=true", '--force'];
await buildCocos(args);
const args = ['--path', './', '--build', "platform=ios;debug=false;md5Cache=true;buildPath=build_android;appABIs=['armeabi-v7a','x86','x86_64','arm64-v8a'];encryptJs=true;xxteaKey=6bbfce23-28b4-4a;zipCompressJs=true", '--force'];
await buildCocos(args);
}
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'];
await buildCocos(args);
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'];
await buildCocos(args);
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){
const androidPaths = fs.readdirSync(`dist/android/${projectName}`);
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);
iosVersion = iosConfigFileName.split('.')[1];
} else {
if(type=="android"){
const androidPaths = fs.readdirSync(`dist/android/${projectName}`);
const androidConfigFileName = androidPaths.find(path => path.indexOf('config') == 0);
androidVersion = androidConfigFileName.split('.')[1];
}else{
const iosPaths = fs.readdirSync(`dist/ios/${projectName}`);
const iosConfigFileName = iosPaths.find(path => path.indexOf('config') == 0);
iosVersion = iosConfigFileName.split('.')[1];
}
}
const config = {
"ios": {
"sceneName": projectName,
"version": iosVersion
},
"android": {
"sceneName": projectName,
"version": androidVersion
}
}
fs.writeFileSync('dist/config.json', JSON.stringify(config));
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);
androidVersion = androidConfigFileName.split('.')[1];
const iosPaths = fs.readdirSync(`dist/ios/${projectName}`);
const iosConfigFileName = iosPaths.find((path) => path.indexOf('config') == 0);
iosVersion = iosConfigFileName.split('.')[1];
} else {
if (type == 'android') {
const androidPaths = fs.readdirSync(`dist/android/${projectName}`);
const androidConfigFileName = androidPaths.find((path) => path.indexOf('config') == 0);
androidVersion = androidConfigFileName.split('.')[1];
} else {
const iosPaths = fs.readdirSync(`dist/ios/${projectName}`);
const iosConfigFileName = iosPaths.find((path) => path.indexOf('config') == 0);
iosVersion = iosConfigFileName.split('.')[1];
}
}
const config = {
ios: {
sceneName: projectName,
version: iosVersion,
},
android: {
sceneName: projectName,
version: androidVersion,
},
};
fs.writeFileSync('dist/config.json', JSON.stringify(config));
}
function compressAll (projectName) {
const tarStream = new compressing.zip.Stream();
tarStream.addEntry('dist/play');
tarStream.addEntry('dist/form');
tarStream.addEntry('dist/ios');
tarStream.addEntry('dist/android');
tarStream.addEntry('dist/web_desktop');
tarStream.addEntry('dist/config.json');
const destStream = fs.createWriteStream(`publish/${getReleaseFileName(projectName)}.zip`);
tarStream.pipe(destStream);
function compressAll(projectName) {
const tarStream = new compressing.zip.Stream();
tarStream.addEntry('dist/play');
tarStream.addEntry('dist/form');
tarStream.addEntry('dist/ios');
tarStream.addEntry('dist/android');
tarStream.addEntry('dist/web_desktop');
tarStream.addEntry('dist/config.json');
const destStream = fs.createWriteStream(`publish/${getReleaseFileName(projectName)}.zip`);
tarStream.pipe(destStream);
}
function build_check () {
const dirNames = process.cwd().split(/\/|\\/);
const projectName = dirNames[dirNames.length - 1];
const path = 'assets'
let folderName = '';
fs.readdirSync(path).find(fileName => {
const st = fs.statSync(`${path}/${fileName}`);
if (st.isDirectory()) {
folderName = fileName;
}
});
if (projectName != folderName) {
throw (`项目名(${projectName})与bundle文件夹名(${folderName})不相同`);
}
let same = false;
const files = fs.readdirSync(`${path}/${folderName}/scene`);
files.forEach(fileName => {
fileName.split('.').forEach((str, idx, arr) => {
if (str == 'fire') {
const sceneName = arr[idx - 1];
if (folderName == sceneName) {
same = true;
}
}
})
});
if (!same) {
throw (`bundle文件夹名称(${folderName})与scene名称不相同`);
}
return projectName;
function build_check() {
const dirNames = process.cwd().split(/\/|\\/);
const projectName = dirNames[dirNames.length - 1];
const path = 'assets';
let folderName = '';
fs.readdirSync(path).find((fileName) => {
const st = fs.statSync(`${path}/${fileName}`);
if (st.isDirectory()) {
folderName = fileName;
}
});
if (projectName != folderName) {
throw `项目名(${projectName})与bundle文件夹名(${folderName})不相同`;
}
let same = false;
const files = fs.readdirSync(`${path}/${folderName}/scene`);
files.forEach((fileName) => {
fileName.split('.').forEach((str, idx, arr) => {
if (str == 'fire') {
const sceneName = arr[idx - 1];
if (folderName == sceneName) {
same = true;
}
}
});
});
if (!same) {
throw `bundle文件夹名称(${folderName})与scene名称不相同`;
}
return projectName;
}
function changeSettingToWebDesktop () {
const path = 'assets'
const folderName = getFolderName(path);
editFolderMeta(path, folderName, false);
function changeSettingToWebDesktop() {
const path = 'assets';
const folderName = getFolderName(path);
editFolderMeta(path, folderName, false);
}
function changeSettingsToBundle () {
const path = 'assets'
const folderName = getFolderName(path);
editFolderMeta(path, folderName, true);
function changeSettingsToBundle() {
const path = 'assets';
const folderName = getFolderName(path);
editFolderMeta(path, folderName, true);
}
function replaceUuids () {
console.log('build_step_0 开始~!');
const path = 'assets'
function getFolderName(path) {
let folderName = '';
fs.readdirSync(path).find(fileName => {
const st = fs.statSync(`${path}/${fileName}`);
if (st.isDirectory()) {
folderName = fileName;
}
});
return folderName;
}
const folderName = getFolderName(path);
let oldFireUuid = '';
let oldJsUuid = '';
let oldJsShortUuid = '';
let oldJsId = '';
const fireMetaStr = fs.readFileSync(`assets/${folderName}/scene/${folderName}.fire.meta`);
if (fireMetaStr.indexOf('57ea7c61-9b8b-498a-b024-c98ee9124beb') > 0) {
// 老Cocos脚手架
oldFireUuid = '57ea7c61-9b8b-498a-b024-c98ee9124beb';
oldJsUuid = 'f4ede462-f8d7-4069-ba80-915611c058ca';
oldJsShortUuid = 'f4edeRi+NdAabqAkVYRwFjK';
oldJsId = 'e687yyoRBIzZAOVRL8Sseh';
}
if (fireMetaStr.indexOf('0737ce42-24f0-45c6-8e1a-8bdab4f74ba3') > 0) {
// 新Cocos脚手架
oldFireUuid = '0737ce42-24f0-45c6-8e1a-8bdab4f74ba3';
oldJsUuid = '408a67f8-65fa-4cf1-8cf2-83e20e1a0fd5';
oldJsShortUuid = '408a6f4ZfpM8Yzyg+IOGg/V';
oldJsId = 'eaTVUpqahPfZeO9+sUI7RP';
}
if (oldFireUuid === '') {
return;
}
function editFolderMeta(path, folderName) {
const metaPath = `${path}/${folderName}.meta`;
const metaDataStr = fs.readFileSync(metaPath);
const metaData = JSON.parse(metaDataStr);
metaData.isBundle = false;
fs.writeFileSync(metaPath, JSON.stringify(metaData));
}
function fileReplace(path, replaceStr, newStr) {
if (!fs.existsSync(path)) {
return;
}
const fileStr = fs.readFileSync(path);
const newFileStr = fileStr.toString().replace(new RegExp(replaceStr.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), 'g'), newStr);
fs.writeFileSync(path, newFileStr);
}
function getShortUuid(uuid) {
const bytes = parse(uuid).subarray(1);
return uuid.substring(0, 5) + Base64.fromUint8Array(bytes).substring(2);
}
editFolderMeta(path, folderName);
const newFireUuid = v4();
fileReplace(`assets/${folderName}/scene/${folderName}.fire.meta`, oldFireUuid, newFireUuid);
fileReplace(`assets/${folderName}/scene/${folderName}.fire`, oldFireUuid, newFireUuid);
fileReplace('settings/builder.json', oldFireUuid, newFireUuid);
const newJsUuid = v4();
const newJsShortUuid = getShortUuid(newJsUuid);
const newJsId = v4().replace(/-/g, '').substring(0, oldJsId.length);
fileReplace(`assets/${folderName}/scene/${folderName}.ts.meta`, oldJsUuid, newJsUuid);
fileReplace(`assets/${folderName}/scene/${folderName}.js.meta`, oldJsUuid, newJsUuid);
fileReplace(`assets/${folderName}/scene/${folderName}.fire`, oldFireUuid, newFireUuid);
fileReplace(`assets/${folderName}/scene/${folderName}.fire`, oldJsShortUuid, newJsShortUuid);
fileReplace(`assets/${folderName}/scene/${folderName}.fire`, oldJsId, newJsId);
console.log('build_step_0 完成~!');
function replaceUuids() {
console.log('build_step_0 开始~!');
const path = 'assets';
function getFolderName(path) {
let folderName = '';
fs.readdirSync(path).find((fileName) => {
const st = fs.statSync(`${path}/${fileName}`);
if (st.isDirectory()) {
folderName = fileName;
}
});
return folderName;
}
const folderName = getFolderName(path);
let oldFireUuid = '';
let oldJsUuid = '';
let oldJsShortUuid = '';
let oldJsId = '';
const fireMetaStr = fs.readFileSync(`assets/${folderName}/scene/${folderName}.fire.meta`);
if (fireMetaStr.indexOf('57ea7c61-9b8b-498a-b024-c98ee9124beb') > 0) {
// 老Cocos脚手架
oldFireUuid = '57ea7c61-9b8b-498a-b024-c98ee9124beb';
oldJsUuid = 'f4ede462-f8d7-4069-ba80-915611c058ca';
oldJsShortUuid = 'f4edeRi+NdAabqAkVYRwFjK';
oldJsId = 'e687yyoRBIzZAOVRL8Sseh';
}
if (fireMetaStr.indexOf('0737ce42-24f0-45c6-8e1a-8bdab4f74ba3') > 0) {
// 新Cocos脚手架
oldFireUuid = '0737ce42-24f0-45c6-8e1a-8bdab4f74ba3';
oldJsUuid = '408a67f8-65fa-4cf1-8cf2-83e20e1a0fd5';
oldJsShortUuid = '408a6f4ZfpM8Yzyg+IOGg/V';
oldJsId = 'eaTVUpqahPfZeO9+sUI7RP';
}
if (oldFireUuid === '') {
return;
}
function editFolderMeta(path, folderName) {
const metaPath = `${path}/${folderName}.meta`;
const metaDataStr = fs.readFileSync(metaPath);
const metaData = JSON.parse(metaDataStr);
metaData.isBundle = false;
fs.writeFileSync(metaPath, JSON.stringify(metaData));
}
function fileReplace(path, replaceStr, newStr) {
if (!fs.existsSync(path)) {
return;
}
const fileStr = fs.readFileSync(path);
const newFileStr = fileStr.toString().replace(new RegExp(replaceStr.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g'), newStr);
fs.writeFileSync(path, newFileStr);
}
function getShortUuid(uuid) {
const bytes = parse(uuid).subarray(1);
return uuid.substring(0, 5) + Base64.fromUint8Array(bytes).substring(2);
}
editFolderMeta(path, folderName);
const newFireUuid = v4();
fileReplace(`assets/${folderName}/scene/${folderName}.fire.meta`, oldFireUuid, newFireUuid);
fileReplace(`assets/${folderName}/scene/${folderName}.fire`, oldFireUuid, newFireUuid);
fileReplace('settings/builder.json', oldFireUuid, newFireUuid);
const newJsUuid = v4();
const newJsShortUuid = getShortUuid(newJsUuid);
const newJsId = v4().replace(/-/g, '').substring(0, oldJsId.length);
fileReplace(`assets/${folderName}/scene/${folderName}.ts.meta`, oldJsUuid, newJsUuid);
fileReplace(`assets/${folderName}/scene/${folderName}.js.meta`, oldJsUuid, newJsUuid);
fileReplace(`assets/${folderName}/scene/${folderName}.fire`, oldFireUuid, newFireUuid);
fileReplace(`assets/${folderName}/scene/${folderName}.fire`, oldJsShortUuid, newJsShortUuid);
fileReplace(`assets/${folderName}/scene/${folderName}.fire`, oldJsId, newJsId);
console.log('build_step_0 完成~!');
}
function replaceIndexHtml () {
const data = fs.readFileSync('index.html');
fs.writeFileSync('dist/play/index.html', data);
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();
// 构建前检查
const projectName = build_check();
// 清理旧文件
// 构建form
await removeDir('dist/form');
await buildForm();
// 替换uuid
replaceUuids();
// 改设置为非bundle
changeSettingToWebDesktop();
// 构建play
await removeDir('dist/play');
await buildWebDesktop();
await copyDir('build/web-desktop', 'dist/play');
replaceIndexHtml();
console.log('构建 web desktop 成功!');
// 改设置为bundle
changeSettingsToBundle();
await removeDir('dist/android');
await buildAndroidBundle();
await copyDir('build_android/jsb-link/remote', 'dist/android');
console.log('构建 android bundle 成功!');
await removeDir('dist/ios');
await buildIosBundle();
await copyDir('build_ios/jsb-link/remote', 'dist/ios');
console.log('构建 ios bundle 成功!');
await removeDir('dist/web_desktop');
await buildWebBundle();
await copyDir(`build_web_desktop/web-desktop/assets/${projectName}`, 'dist/web_desktop');
console.log('构建 web bundle 成功!');
// 改设置为非bundle
changeSettingToWebDesktop();
createConfigFile(projectName);
compressAll(projectName);
await removeDir('build');
await removeDir('build_android');
await removeDir('build_ios');
await removeDir('build_web_desktop');
const endTime = new Date().getTime();
const duration = new Date(endTime - startTime);
console.log(`打包完成!`);
console.log(`用时${duration.getMinutes()}${duration.getSeconds()}秒。`);
},
buildAndroid: async function () {
// 构建前检查
const projectName = build_check();
// 替换uuid
replaceUuids();
// 改设置为bundle
changeSettingsToBundle();
await removeDir('dist/android');
await buildAndroidBundle();
await copyDir('build_android/jsb-link/remote', 'dist/android');
// 改设置为非bundle
changeSettingToWebDesktop();
createConfigFile(projectName, "android");
await removeDir('build_android');
console.log('构建 android bundle 成功!');
},
buildIos: async function () {
// 构建前检查
const projectName = build_check();
// 替换uuid
replaceUuids();
// 改设置为bundle
changeSettingsToBundle();
await removeDir('dist/ios');
await buildIosBundle();
await copyDir('build_ios/jsb-link/remote', 'dist/ios');
// 改设置为非bundle
changeSettingToWebDesktop();
createConfigFile(projectName, "ios");
await removeDir('build_ios');
console.log('构建 ios bundle 成功!');
}
build: async function () {
const startTime = new Date().getTime();
// 构建前检查
const projectName = build_check();
// 清理旧文件
// 构建form
await removeDir('dist/form');
await buildForm();
// 替换uuid
replaceUuids();
// 改设置为非bundle
changeSettingToWebDesktop();
// 构建play
await removeDir('dist/play');
await buildWebDesktop();
await copyDir('build/web-desktop', 'dist/play');
replaceIndexHtml();
console.log('构建 web desktop 成功!');
// 改设置为bundle
changeSettingsToBundle();
await removeDir('dist/android');
await buildAndroidBundle();
await copyDir('build_android/jsb-link/remote', 'dist/android');
console.log('构建 android bundle 成功!');
await removeDir('dist/ios');
await buildIosBundle();
await copyDir('build_ios/jsb-link/remote', 'dist/ios');
console.log('构建 ios bundle 成功!');
await removeDir('dist/web_desktop');
await buildWebBundle();
await copyDir(`build_web_desktop/web-desktop/assets/${projectName}`, 'dist/web_desktop');
console.log('构建 web bundle 成功!');
// 改设置为非bundle
changeSettingToWebDesktop();
createConfigFile(projectName);
compressAll(projectName);
await removeDir('build');
await removeDir('build_android');
await removeDir('build_ios');
await removeDir('build_web_desktop');
const endTime = new Date().getTime();
const duration = new Date(endTime - startTime);
console.log(`打包完成!`);
console.log(`用时${duration.getMinutes()}${duration.getSeconds()}秒。`);
},
buildAndroid: async function () {
// 构建前检查
const projectName = build_check();
// 替换uuid
replaceUuids();
// 改设置为bundle
changeSettingsToBundle();
await removeDir('dist/android');
await buildAndroidBundle();
await copyDir('build_android/jsb-link/remote', 'dist/android');
// 改设置为非bundle
changeSettingToWebDesktop();
createConfigFile(projectName, 'android');
await removeDir('build_android');
console.log('构建 android bundle 成功!');
},
buildIos: async function () {
// 构建前检查
const projectName = build_check();
// 替换uuid
replaceUuids();
// 改设置为bundle
changeSettingsToBundle();
await removeDir('dist/ios');
await buildIosBundle();
await copyDir('build_ios/jsb-link/remote', 'dist/ios');
// 改设置为非bundle
changeSettingToWebDesktop();
createConfigFile(projectName, 'ios');
await removeDir('build_ios');
console.log('构建 ios bundle 成功!');
},
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment