Commit 43990b1d authored by 张世斌's avatar 张世斌

1.修复bug

parent 39292dd9
...@@ -17,10 +17,10 @@ ...@@ -17,10 +17,10 @@
"__id__": 2 "__id__": 2
}, },
{ {
"__id__": 165 "__id__": 163
}, },
{ {
"__id__": 201 "__id__": 199
} }
], ],
"_active": false, "_active": false,
...@@ -81,25 +81,22 @@ ...@@ -81,25 +81,22 @@
"__id__": 5 "__id__": 5
}, },
{ {
"__id__": 151 "__id__": 150
}, },
{ {
"__id__": 159 "__id__": 158
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 161 "__id__": 160
},
{
"__id__": 162
}, },
{ {
"__id__": 163 "__id__": 161
}, },
{ {
"__id__": 164 "__id__": 162
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -272,25 +269,25 @@ ...@@ -272,25 +269,25 @@
"__id__": 67 "__id__": 67
}, },
{ {
"__id__": 76 "__id__": 75
}, },
{ {
"__id__": 86 "__id__": 85
}, },
{ {
"__id__": 98 "__id__": 97
}, },
{ {
"__id__": 140 "__id__": 139
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 149 "__id__": 148
}, },
{ {
"__id__": 150 "__id__": 149
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3609,16 +3606,16 @@ ...@@ -3609,16 +3606,16 @@
"__id__": 68 "__id__": 68
}, },
{ {
"__id__": 71 "__id__": 70
} }
], ],
"_active": false, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 74 "__id__": 73
}, },
{ {
"__id__": 75 "__id__": 74
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3681,9 +3678,6 @@ ...@@ -3681,9 +3678,6 @@
"_components": [ "_components": [
{ {
"__id__": 69 "__id__": 69
},
{
"__id__": 70
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3734,36 +3728,6 @@ ...@@ -3734,36 +3728,6 @@
"groupIndex": 0, "groupIndex": 0,
"_id": "ba+gl/ikFLvqBpcIqgGNfB" "_id": "ba+gl/ikFLvqBpcIqgGNfB"
}, },
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 68
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 1,
"_dstBlendFactor": 771,
"_spriteFrame": null,
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "6e9DUVAelKHIYf84TYZZfT"
},
{ {
"__type__": "cc.Widget", "__type__": "cc.Widget",
"_name": "", "_name": "",
...@@ -3802,10 +3766,10 @@ ...@@ -3802,10 +3766,10 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 72 "__id__": 71
}, },
{ {
"__id__": 73 "__id__": 72
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3861,7 +3825,7 @@ ...@@ -3861,7 +3825,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 71 "__id__": 70
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -3891,7 +3855,7 @@ ...@@ -3891,7 +3855,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 71 "__id__": 70
}, },
"_enabled": true, "_enabled": true,
"alignMode": 1, "alignMode": 1,
...@@ -3981,13 +3945,13 @@ ...@@ -3981,13 +3945,13 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 77 "__id__": 76
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 85 "__id__": 84
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4043,23 +4007,23 @@ ...@@ -4043,23 +4007,23 @@
"_name": "paint", "_name": "paint",
"_objFlags": 512, "_objFlags": 512,
"_parent": { "_parent": {
"__id__": 76 "__id__": 75
}, },
"_children": [ "_children": [
{ {
"__id__": 78 "__id__": 77
}, },
{ {
"__id__": 80 "__id__": 79
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 83 "__id__": 82
}, },
{ {
"__id__": 84 "__id__": 83
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4115,13 +4079,13 @@ ...@@ -4115,13 +4079,13 @@
"_name": "alligator", "_name": "alligator",
"_objFlags": 512, "_objFlags": 512,
"_parent": { "_parent": {
"__id__": 77 "__id__": 76
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 79 "__id__": 78
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4177,7 +4141,7 @@ ...@@ -4177,7 +4141,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 78 "__id__": 77
}, },
"_enabled": true, "_enabled": true,
"alignMode": 1, "alignMode": 1,
...@@ -4204,16 +4168,16 @@ ...@@ -4204,16 +4168,16 @@
"_name": "bg_img", "_name": "bg_img",
"_objFlags": 512, "_objFlags": 512,
"_parent": { "_parent": {
"__id__": 77 "__id__": 76
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 81 "__id__": 80
}, },
{ {
"__id__": 82 "__id__": 81
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4269,7 +4233,7 @@ ...@@ -4269,7 +4233,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 80 "__id__": 79
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -4299,7 +4263,7 @@ ...@@ -4299,7 +4263,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 80 "__id__": 79
}, },
"_enabled": true, "_enabled": true,
"alignMode": 1, "alignMode": 1,
...@@ -4326,7 +4290,7 @@ ...@@ -4326,7 +4290,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 77 "__id__": 76
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -4358,7 +4322,7 @@ ...@@ -4358,7 +4322,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 77 "__id__": 76
}, },
"_enabled": true, "_enabled": true,
"alignMode": 1, "alignMode": 1,
...@@ -4385,7 +4349,7 @@ ...@@ -4385,7 +4349,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 76 "__id__": 75
}, },
"_enabled": true, "_enabled": true,
"alignMode": 1, "alignMode": 1,
...@@ -4416,19 +4380,19 @@ ...@@ -4416,19 +4380,19 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 87 "__id__": 86
}, },
{ {
"__id__": 91 "__id__": 90
}, },
{ {
"__id__": 94 "__id__": 93
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 97 "__id__": 96
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4484,19 +4448,19 @@ ...@@ -4484,19 +4448,19 @@
"_name": "btn_submit", "_name": "btn_submit",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 86 "__id__": 85
}, },
"_children": [], "_children": [],
"_active": false, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 88 "__id__": 87
}, },
{ {
"__id__": 89 "__id__": 88
}, },
{ {
"__id__": 90 "__id__": 89
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4552,7 +4516,7 @@ ...@@ -4552,7 +4516,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 87 "__id__": 86
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -4584,7 +4548,7 @@ ...@@ -4584,7 +4548,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 87 "__id__": 86
}, },
"_enabled": true, "_enabled": true,
"alignMode": 1, "alignMode": 1,
...@@ -4611,7 +4575,7 @@ ...@@ -4611,7 +4575,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 87 "__id__": 86
}, },
"_enabled": true, "_enabled": true,
"_normalMaterial": null, "_normalMaterial": null,
...@@ -4679,16 +4643,16 @@ ...@@ -4679,16 +4643,16 @@
"_name": "coolcat", "_name": "coolcat",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 86 "__id__": 85
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 92 "__id__": 91
}, },
{ {
"__id__": 93 "__id__": 92
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4744,7 +4708,7 @@ ...@@ -4744,7 +4708,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 91 "__id__": 90
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -4784,7 +4748,7 @@ ...@@ -4784,7 +4748,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 91 "__id__": 90
}, },
"_enabled": true, "_enabled": true,
"alignMode": 1, "alignMode": 1,
...@@ -4811,16 +4775,16 @@ ...@@ -4811,16 +4775,16 @@
"_name": "BtnCoolCat", "_name": "BtnCoolCat",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 86 "__id__": 85
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 95 "__id__": 94
}, },
{ {
"__id__": 96 "__id__": 95
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4876,7 +4840,7 @@ ...@@ -4876,7 +4840,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 94 "__id__": 93
}, },
"_enabled": true, "_enabled": true,
"alignMode": 1, "alignMode": 1,
...@@ -4903,7 +4867,7 @@ ...@@ -4903,7 +4867,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 94 "__id__": 93
}, },
"_enabled": true, "_enabled": true,
"_normalMaterial": null, "_normalMaterial": null,
...@@ -4971,7 +4935,7 @@ ...@@ -4971,7 +4935,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 86 "__id__": 85
}, },
"_enabled": true, "_enabled": true,
"alignMode": 1, "alignMode": 1,
...@@ -5002,13 +4966,13 @@ ...@@ -5002,13 +4966,13 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 99 "__id__": 98
} }
], ],
"_active": false, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 139 "__id__": 138
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -5064,23 +5028,23 @@ ...@@ -5064,23 +5028,23 @@
"_name": "paint", "_name": "paint",
"_objFlags": 512, "_objFlags": 512,
"_parent": { "_parent": {
"__id__": 98 "__id__": 97
}, },
"_children": [ "_children": [
{ {
"__id__": 100 "__id__": 99
}, },
{ {
"__id__": 134 "__id__": 133
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 137 "__id__": 136
}, },
{ {
"__id__": 138 "__id__": 137
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -5136,38 +5100,38 @@ ...@@ -5136,38 +5100,38 @@
"_name": "alligator", "_name": "alligator",
"_objFlags": 512, "_objFlags": 512,
"_parent": { "_parent": {
"__id__": 99 "__id__": 98
}, },
"_children": [ "_children": [
{ {
"__id__": 101 "__id__": 100
}, },
{ {
"__id__": 105 "__id__": 104
}, },
{ {
"__id__": 109 "__id__": 108
}, },
{ {
"__id__": 113 "__id__": 112
}, },
{ {
"__id__": 117 "__id__": 116
}, },
{ {
"__id__": 121 "__id__": 120
}, },
{ {
"__id__": 125 "__id__": 124
}, },
{ {
"__id__": 129 "__id__": 128
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 133 "__id__": 132
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -5223,17 +5187,17 @@ ...@@ -5223,17 +5187,17 @@
"_name": "t2", "_name": "t2",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 100 "__id__": 99
}, },
"_children": [ "_children": [
{ {
"__id__": 102 "__id__": 101
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 104 "__id__": 103
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -5289,13 +5253,13 @@ ...@@ -5289,13 +5253,13 @@
"_name": "word", "_name": "word",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 101 "__id__": 100
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 103 "__id__": 102
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -5351,7 +5315,7 @@ ...@@ -5351,7 +5315,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 102 "__id__": 101
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -5386,7 +5350,7 @@ ...@@ -5386,7 +5350,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 101 "__id__": 100
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -5418,17 +5382,17 @@ ...@@ -5418,17 +5382,17 @@
"_name": "t3", "_name": "t3",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 100 "__id__": 99
}, },
"_children": [ "_children": [
{ {
"__id__": 106 "__id__": 105
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 108 "__id__": 107
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -5484,13 +5448,13 @@ ...@@ -5484,13 +5448,13 @@
"_name": "word", "_name": "word",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 105 "__id__": 104
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 107 "__id__": 106
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -5546,7 +5510,7 @@ ...@@ -5546,7 +5510,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 106 "__id__": 105
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -5581,7 +5545,7 @@ ...@@ -5581,7 +5545,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 105 "__id__": 104
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -5613,17 +5577,17 @@ ...@@ -5613,17 +5577,17 @@
"_name": "t4", "_name": "t4",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 100 "__id__": 99
}, },
"_children": [ "_children": [
{ {
"__id__": 110 "__id__": 109
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 112 "__id__": 111
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -5679,13 +5643,13 @@ ...@@ -5679,13 +5643,13 @@
"_name": "word", "_name": "word",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 109 "__id__": 108
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 111 "__id__": 110
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -5741,7 +5705,7 @@ ...@@ -5741,7 +5705,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 110 "__id__": 109
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -5776,7 +5740,7 @@ ...@@ -5776,7 +5740,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 109 "__id__": 108
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -5808,17 +5772,17 @@ ...@@ -5808,17 +5772,17 @@
"_name": "t5", "_name": "t5",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 100 "__id__": 99
}, },
"_children": [ "_children": [
{ {
"__id__": 114 "__id__": 113
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 116 "__id__": 115
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -5874,13 +5838,13 @@ ...@@ -5874,13 +5838,13 @@
"_name": "word", "_name": "word",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 113 "__id__": 112
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 115 "__id__": 114
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -5936,7 +5900,7 @@ ...@@ -5936,7 +5900,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 114 "__id__": 113
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -5971,7 +5935,7 @@ ...@@ -5971,7 +5935,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 113 "__id__": 112
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -6003,17 +5967,17 @@ ...@@ -6003,17 +5967,17 @@
"_name": "t6", "_name": "t6",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 100 "__id__": 99
}, },
"_children": [ "_children": [
{ {
"__id__": 118 "__id__": 117
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 120 "__id__": 119
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -6069,13 +6033,13 @@ ...@@ -6069,13 +6033,13 @@
"_name": "word", "_name": "word",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 117 "__id__": 116
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 119 "__id__": 118
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -6131,7 +6095,7 @@ ...@@ -6131,7 +6095,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 118 "__id__": 117
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -6166,7 +6130,7 @@ ...@@ -6166,7 +6130,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 117 "__id__": 116
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -6198,17 +6162,17 @@ ...@@ -6198,17 +6162,17 @@
"_name": "t7", "_name": "t7",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 100 "__id__": 99
}, },
"_children": [ "_children": [
{ {
"__id__": 122 "__id__": 121
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 124 "__id__": 123
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -6264,13 +6228,13 @@ ...@@ -6264,13 +6228,13 @@
"_name": "word", "_name": "word",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 121 "__id__": 120
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 123 "__id__": 122
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -6326,7 +6290,7 @@ ...@@ -6326,7 +6290,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 122 "__id__": 121
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -6361,7 +6325,7 @@ ...@@ -6361,7 +6325,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 121 "__id__": 120
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -6393,17 +6357,17 @@ ...@@ -6393,17 +6357,17 @@
"_name": "t8", "_name": "t8",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 100 "__id__": 99
}, },
"_children": [ "_children": [
{ {
"__id__": 126 "__id__": 125
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 128 "__id__": 127
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -6459,13 +6423,13 @@ ...@@ -6459,13 +6423,13 @@
"_name": "word", "_name": "word",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 125 "__id__": 124
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 127 "__id__": 126
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -6521,7 +6485,7 @@ ...@@ -6521,7 +6485,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 126 "__id__": 125
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -6556,7 +6520,7 @@ ...@@ -6556,7 +6520,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 125 "__id__": 124
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -6588,17 +6552,17 @@ ...@@ -6588,17 +6552,17 @@
"_name": "t9", "_name": "t9",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 100 "__id__": 99
}, },
"_children": [ "_children": [
{ {
"__id__": 130 "__id__": 129
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 132 "__id__": 131
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -6654,13 +6618,13 @@ ...@@ -6654,13 +6618,13 @@
"_name": "word", "_name": "word",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 129 "__id__": 128
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 131 "__id__": 130
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -6716,7 +6680,7 @@ ...@@ -6716,7 +6680,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 130 "__id__": 129
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -6751,7 +6715,7 @@ ...@@ -6751,7 +6715,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 129 "__id__": 128
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -6783,7 +6747,7 @@ ...@@ -6783,7 +6747,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 100 "__id__": 99
}, },
"_enabled": true, "_enabled": true,
"alignMode": 1, "alignMode": 1,
...@@ -6810,16 +6774,16 @@ ...@@ -6810,16 +6774,16 @@
"_name": "alligator_img", "_name": "alligator_img",
"_objFlags": 512, "_objFlags": 512,
"_parent": { "_parent": {
"__id__": 99 "__id__": 98
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 135 "__id__": 134
}, },
{ {
"__id__": 136 "__id__": 135
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -6875,7 +6839,7 @@ ...@@ -6875,7 +6839,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 134 "__id__": 133
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -6907,7 +6871,7 @@ ...@@ -6907,7 +6871,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 134 "__id__": 133
}, },
"_enabled": true, "_enabled": true,
"alignMode": 1, "alignMode": 1,
...@@ -6934,7 +6898,7 @@ ...@@ -6934,7 +6898,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 99 "__id__": 98
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -6964,7 +6928,7 @@ ...@@ -6964,7 +6928,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 99 "__id__": 98
}, },
"_enabled": true, "_enabled": true,
"alignMode": 1, "alignMode": 1,
...@@ -6991,7 +6955,7 @@ ...@@ -6991,7 +6955,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 98 "__id__": 97
}, },
"_enabled": true, "_enabled": true,
"alignMode": 1, "alignMode": 1,
...@@ -7022,22 +6986,22 @@ ...@@ -7022,22 +6986,22 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 141 "__id__": 140
}, },
{ {
"__id__": 143 "__id__": 142
}, },
{ {
"__id__": 145 "__id__": 144
} }
], ],
"_active": false, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 147 "__id__": 146
}, },
{ {
"__id__": 148 "__id__": 147
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -7093,13 +7057,13 @@ ...@@ -7093,13 +7057,13 @@
"_name": "bg_circle2", "_name": "bg_circle2",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 140 "__id__": 139
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 142 "__id__": 141
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -7155,7 +7119,7 @@ ...@@ -7155,7 +7119,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 141 "__id__": 140
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -7187,13 +7151,13 @@ ...@@ -7187,13 +7151,13 @@
"_name": "bg_circle", "_name": "bg_circle",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 140 "__id__": 139
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 144 "__id__": 143
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -7249,7 +7213,7 @@ ...@@ -7249,7 +7213,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 143 "__id__": 142
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -7281,13 +7245,13 @@ ...@@ -7281,13 +7245,13 @@
"_name": "btn_replay", "_name": "btn_replay",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 140 "__id__": 139
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 146 "__id__": 145
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -7343,7 +7307,7 @@ ...@@ -7343,7 +7307,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 145 "__id__": 144
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -7375,7 +7339,7 @@ ...@@ -7375,7 +7339,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 140 "__id__": 139
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -7407,7 +7371,7 @@ ...@@ -7407,7 +7371,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 140 "__id__": 139
}, },
"_enabled": true, "_enabled": true,
"_normalMaterial": null, "_normalMaterial": null,
...@@ -7538,19 +7502,19 @@ ...@@ -7538,19 +7502,19 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 152 "__id__": 151
}, },
{ {
"__id__": 155 "__id__": 154
} }
], ],
"_active": false, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 157 "__id__": 156
}, },
{ {
"__id__": 158 "__id__": 157
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -7606,16 +7570,16 @@ ...@@ -7606,16 +7570,16 @@
"_name": "start_bg", "_name": "start_bg",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 151 "__id__": 150
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 153 "__id__": 152
}, },
{ {
"__id__": 154 "__id__": 153
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -7671,7 +7635,7 @@ ...@@ -7671,7 +7635,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 152 "__id__": 151
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -7703,7 +7667,7 @@ ...@@ -7703,7 +7667,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 152 "__id__": 151
}, },
"_enabled": true, "_enabled": true,
"alignMode": 1, "alignMode": 1,
...@@ -7730,13 +7694,13 @@ ...@@ -7730,13 +7694,13 @@
"_name": "start", "_name": "start",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 151 "__id__": 150
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 156 "__id__": 155
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -7792,7 +7756,7 @@ ...@@ -7792,7 +7756,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 155 "__id__": 154
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -7824,7 +7788,7 @@ ...@@ -7824,7 +7788,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 151 "__id__": 150
}, },
"_enabled": true, "_enabled": true,
"_normalMaterial": null, "_normalMaterial": null,
...@@ -7885,7 +7849,7 @@ ...@@ -7885,7 +7849,7 @@
"hoverSprite": null, "hoverSprite": null,
"_N$disabledSprite": null, "_N$disabledSprite": null,
"_N$target": { "_N$target": {
"__id__": 151 "__id__": 150
}, },
"_id": "dcCiAjNMREj6CcPYJOxYXZ" "_id": "dcCiAjNMREj6CcPYJOxYXZ"
}, },
...@@ -7894,7 +7858,7 @@ ...@@ -7894,7 +7858,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 151 "__id__": 150
}, },
"_enabled": true, "_enabled": true,
"alignMode": 1, "alignMode": 1,
...@@ -7927,7 +7891,7 @@ ...@@ -7927,7 +7891,7 @@
"_active": false, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 160 "__id__": 159
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -7983,7 +7947,7 @@ ...@@ -7983,7 +7947,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 159 "__id__": 158
}, },
"_enabled": true, "_enabled": true,
"_cullingMask": 2, "_cullingMask": 2,
...@@ -8065,9 +8029,9 @@ ...@@ -8065,9 +8029,9 @@
"node": { "node": {
"__id__": 2 "__id__": 2
}, },
"_enabled": false, "_enabled": true,
"paint": { "paint": {
"__id__": 77 "__id__": 76
}, },
"paint2": { "paint2": {
"__id__": 67 "__id__": 67
...@@ -8079,10 +8043,10 @@ ...@@ -8079,10 +8043,10 @@
"__id__": 15 "__id__": 15
}, },
"coolcat": { "coolcat": {
"__id__": 91 "__id__": 90
}, },
"btn_submit": { "btn_submit": {
"__id__": 90 "__id__": 89
}, },
"btn_next": { "btn_next": {
"__id__": 13 "__id__": 13
...@@ -8139,16 +8103,6 @@ ...@@ -8139,16 +8103,6 @@
], ],
"_id": "35fe3f8bf1a046749cef65" "_id": "35fe3f8bf1a046749cef65"
}, },
{
"__type__": "bf6d8oN2YlJ/qI9GewXHlj+",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_id": "1cXea0elBAHoxKl5dZpdQq"
},
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "res", "_name": "res",
...@@ -8158,13 +8112,13 @@ ...@@ -8158,13 +8112,13 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 166 "__id__": 164
}, },
{ {
"__id__": 179 "__id__": 177
}, },
{ {
"__id__": 198 "__id__": 196
} }
], ],
"_active": true, "_active": true,
...@@ -8222,9 +8176,12 @@ ...@@ -8222,9 +8176,12 @@
"_name": "img", "_name": "img",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 165 "__id__": 163
}, },
"_children": [ "_children": [
{
"__id__": 165
},
{ {
"__id__": 167 "__id__": 167
}, },
...@@ -8239,9 +8196,6 @@ ...@@ -8239,9 +8196,6 @@
}, },
{ {
"__id__": 175 "__id__": 175
},
{
"__id__": 177
} }
], ],
"_active": false, "_active": false,
...@@ -8299,13 +8253,13 @@ ...@@ -8299,13 +8253,13 @@
"_name": "time_strip", "_name": "time_strip",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 166 "__id__": 164
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 168 "__id__": 166
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -8361,7 +8315,7 @@ ...@@ -8361,7 +8315,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 167 "__id__": 165
}, },
"_enabled": true, "_enabled": true,
"_materials": [], "_materials": [],
...@@ -8387,13 +8341,13 @@ ...@@ -8387,13 +8341,13 @@
"_name": "time_strip_bg", "_name": "time_strip_bg",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 166 "__id__": 164
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 170 "__id__": 168
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -8449,7 +8403,7 @@ ...@@ -8449,7 +8403,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 169 "__id__": 167
}, },
"_enabled": true, "_enabled": true,
"_materials": [], "_materials": [],
...@@ -8475,13 +8429,13 @@ ...@@ -8475,13 +8429,13 @@
"_name": "online_bg", "_name": "online_bg",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 166 "__id__": 164
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 172 "__id__": 170
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -8537,7 +8491,7 @@ ...@@ -8537,7 +8491,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 171 "__id__": 169
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -8567,13 +8521,13 @@ ...@@ -8567,13 +8521,13 @@
"_name": "smiling_face", "_name": "smiling_face",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 166 "__id__": 164
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 174 "__id__": 172
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -8629,7 +8583,7 @@ ...@@ -8629,7 +8583,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 173 "__id__": 171
}, },
"_enabled": true, "_enabled": true,
"_materials": [], "_materials": [],
...@@ -8655,13 +8609,13 @@ ...@@ -8655,13 +8609,13 @@
"_name": "star", "_name": "star",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 166 "__id__": 164
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 176 "__id__": 174
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -8717,7 +8671,7 @@ ...@@ -8717,7 +8671,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 175 "__id__": 173
}, },
"_enabled": true, "_enabled": true,
"_materials": [], "_materials": [],
...@@ -8743,13 +8697,13 @@ ...@@ -8743,13 +8697,13 @@
"_name": "me", "_name": "me",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 166 "__id__": 164
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 178 "__id__": 176
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -8805,7 +8759,7 @@ ...@@ -8805,7 +8759,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 177 "__id__": 175
}, },
"_enabled": true, "_enabled": true,
"_materials": [], "_materials": [],
...@@ -8831,9 +8785,12 @@ ...@@ -8831,9 +8785,12 @@
"_name": "audio", "_name": "audio",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 165 "__id__": 163
}, },
"_children": [ "_children": [
{
"__id__": 178
},
{ {
"__id__": 180 "__id__": 180
}, },
...@@ -8857,9 +8814,6 @@ ...@@ -8857,9 +8814,6 @@
}, },
{ {
"__id__": 194 "__id__": 194
},
{
"__id__": 196
} }
], ],
"_active": true, "_active": true,
...@@ -8917,13 +8871,13 @@ ...@@ -8917,13 +8871,13 @@
"_name": "button", "_name": "button",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 179 "__id__": 177
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 181 "__id__": 179
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -8979,7 +8933,7 @@ ...@@ -8979,7 +8933,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 180 "__id__": 178
}, },
"_enabled": true, "_enabled": true,
"_clip": { "_clip": {
...@@ -8998,13 +8952,13 @@ ...@@ -8998,13 +8952,13 @@
"_name": "finish", "_name": "finish",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 179 "__id__": 177
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 183 "__id__": 181
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -9060,7 +9014,7 @@ ...@@ -9060,7 +9014,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 182 "__id__": 180
}, },
"_enabled": true, "_enabled": true,
"_clip": { "_clip": {
...@@ -9079,13 +9033,13 @@ ...@@ -9079,13 +9033,13 @@
"_name": "click", "_name": "click",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 179 "__id__": 177
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 185 "__id__": 183
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -9141,7 +9095,7 @@ ...@@ -9141,7 +9095,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 184 "__id__": 182
}, },
"_enabled": true, "_enabled": true,
"_clip": { "_clip": {
...@@ -9160,13 +9114,13 @@ ...@@ -9160,13 +9114,13 @@
"_name": "correct", "_name": "correct",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 179 "__id__": 177
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 187 "__id__": 185
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -9222,7 +9176,7 @@ ...@@ -9222,7 +9176,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 186 "__id__": 184
}, },
"_enabled": true, "_enabled": true,
"_clip": { "_clip": {
...@@ -9241,13 +9195,13 @@ ...@@ -9241,13 +9195,13 @@
"_name": "incorrect", "_name": "incorrect",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 179 "__id__": 177
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 189 "__id__": 187
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -9303,7 +9257,7 @@ ...@@ -9303,7 +9257,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 188 "__id__": 186
}, },
"_enabled": true, "_enabled": true,
"_clip": { "_clip": {
...@@ -9322,13 +9276,13 @@ ...@@ -9322,13 +9276,13 @@
"_name": "lack", "_name": "lack",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 179 "__id__": 177
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 191 "__id__": 189
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -9384,7 +9338,7 @@ ...@@ -9384,7 +9338,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 190 "__id__": 188
}, },
"_enabled": true, "_enabled": true,
"_clip": { "_clip": {
...@@ -9403,13 +9357,13 @@ ...@@ -9403,13 +9357,13 @@
"_name": "painted", "_name": "painted",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 179 "__id__": 177
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 193 "__id__": 191
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -9465,7 +9419,7 @@ ...@@ -9465,7 +9419,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 192 "__id__": 190
}, },
"_enabled": true, "_enabled": true,
"_clip": { "_clip": {
...@@ -9484,13 +9438,13 @@ ...@@ -9484,13 +9438,13 @@
"_name": "demo", "_name": "demo",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 179 "__id__": 177
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 195 "__id__": 193
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -9546,7 +9500,7 @@ ...@@ -9546,7 +9500,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 194 "__id__": 192
}, },
"_enabled": true, "_enabled": true,
"_clip": { "_clip": {
...@@ -9565,13 +9519,13 @@ ...@@ -9565,13 +9519,13 @@
"_name": "star", "_name": "star",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 179 "__id__": 177
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 197 "__id__": 195
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -9627,7 +9581,7 @@ ...@@ -9627,7 +9581,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 196 "__id__": 194
}, },
"_enabled": true, "_enabled": true,
"_clip": null, "_clip": null,
...@@ -9644,11 +9598,11 @@ ...@@ -9644,11 +9598,11 @@
"_name": "font", "_name": "font",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 165 "__id__": 163
}, },
"_children": [ "_children": [
{ {
"__id__": 199 "__id__": 197
} }
], ],
"_active": false, "_active": false,
...@@ -9706,13 +9660,13 @@ ...@@ -9706,13 +9660,13 @@
"_name": "MMTextBook-Bold", "_name": "MMTextBook-Bold",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 198 "__id__": 196
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 200 "__id__": 198
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -9768,7 +9722,7 @@ ...@@ -9768,7 +9722,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 199 "__id__": 197
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -9807,7 +9761,7 @@ ...@@ -9807,7 +9761,7 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 202 "__id__": 200
} }
], ],
"_active": false, "_active": false,
...@@ -9865,17 +9819,17 @@ ...@@ -9865,17 +9819,17 @@
"_name": "Ff", "_name": "Ff",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 201 "__id__": 199
}, },
"_children": [ "_children": [
{ {
"__id__": 203 "__id__": 201
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 205 "__id__": 203
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -9931,13 +9885,13 @@ ...@@ -9931,13 +9885,13 @@
"_name": "New Label", "_name": "New Label",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 202 "__id__": 200
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 204 "__id__": 202
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -9993,7 +9947,7 @@ ...@@ -9993,7 +9947,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 203 "__id__": 201
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -10028,7 +9982,7 @@ ...@@ -10028,7 +9982,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 202 "__id__": 200
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
......
...@@ -130,10 +130,12 @@ cc.Class({ ...@@ -130,10 +130,12 @@ cc.Class({
this.bindColorButton(item); this.bindColorButton(item);
} }
this._alligator = this.bindAlligator(this.paint); // this._alligator = this.bindAlligator(this.paint);
this._alligator2 = this.bindAlligator(this.paint2); // this._alligator2 = this.bindAlligator(this.paint2);
this._alligator = this.paint.getChildByName("alligator");//children[0];//this.bindAlligator(this.paint);
this._alligator2 = this.paint2.getChildByName("alligator");;//children[0];//this.bindAlligator(this.paint2);
this.bindAlligatorButton(this._alligator); // this.bindAlligatorButton(this._alligator);
this.btn_submit.node.on('click', () => { this.btn_submit.node.on('click', () => {
...@@ -217,28 +219,59 @@ cc.Class({ ...@@ -217,28 +219,59 @@ cc.Class({
this.btn_submit.node.active = false; this.btn_submit.node.active = false;
}, },
// copyColor() {
// let a1 = this._alligator;
// let a2 = this._alligator2;
// let len = a1.teeth.length;
// for (let i = 0; i < len; i++) {
// a2.teeth[i].color = a1.teeth[i].color;
// a2.teeth[i].word.node.color = a1.teeth[i].word.node.color;
// a2.teeth[i].word.string = a1.teeth[i].word.string;
// }
// },
copyColor() { copyColor() {
let a1 = this._alligator; let a1 = this._alligator;
let a2 = this._alligator2; let a2 = this._alligator2;
let len = a1.teeth.length; let len = a1.teeth.length;
for (let i = 0; i < len; i++) { for (let i = 0; i < len; i++) {
a2.teeth[i].color = a1.teeth[i].color; let node=cc.instantiate(a1.teeth[i]);
a2.teeth[i].word.node.color = a1.teeth[i].word.node.color; a2.addChild(node);
a2.teeth[i].word.string = a1.teeth[i].word.string; // a2.teeth[i].color = a1.teeth[i].color;
// a2.teeth[i].word.node.color = a1.teeth[i].word.node.color;
// a2.teeth[i].word.string = a1.teeth[i].word.string;
} }
}, },
initAlligator(node, words) { async initAlligator(parent) {
let tooth, len = node.teeth.length; for(let i=0;i<this.data.images.length;i++){
for (let i = 0; i < len; i++) { let image=this.data.images[i];
tooth = node.teeth[i]; let tooth=await this.getSprNodeByUrl(image.img);
tooth.color = cc.Color.WHITE; parent.addChild(tooth);
tooth.word.node.color = cc.Color.BLACK; // tooth.color = cc.Color.WHITE;
tooth.painted = null; tooth.painted = null;
tooth.word.string = words[i];
} }
// let tooth, len = node.teeth.length;
// for (let i = 0; i < len; i++) {
// tooth = node.teeth[i];
// tooth.color = cc.Color.WHITE;
// tooth.word.node.color = cc.Color.BLACK;
// tooth.painted = null;
// tooth.word.string = words[i];
// }
}, },
// async initAlligator(parent) {
// for(let i=0;i<this.data.images.length;i++){
// let image=this.data.images[i];
// let tooth=await this.getSprNodeByUrl(image.img);
// parent.addChild(tooth);
// // tooth.color = cc.Color.WHITE;
// tooth.painted = null;
// }
// },
bindAlligator(parent) { bindAlligator(parent) {
let node = parent.children[0]; let node = parent.children[0];
...@@ -246,7 +279,7 @@ cc.Class({ ...@@ -246,7 +279,7 @@ cc.Class({
let len = node.children.length; let len = node.children.length;
for (let i = 0; i < len; i++) { for (let i = 0; i < len; i++) {
teeth[i] = node.children[i]; teeth[i] = node.children[i];
teeth[i].word = teeth[i].children[0].getComponent(cc.Label); // teeth[i].word = teeth[i].children[0].getComponent(cc.Label);
} }
node.teeth = teeth; node.teeth = teeth;
...@@ -354,7 +387,7 @@ cc.Class({ ...@@ -354,7 +387,7 @@ cc.Class({
const btn = cc.find('Canvas/bg/btnReplay'); const btn = cc.find('Canvas/bg/btnReplay');
if (btn.active) { if (btn.active) {
playDragonBoneAnimation(this.coolcat, 'finish', -1); playDragonBoneAnimation(this.coolcat, 'finish', -1);
this.playAudioByUrl(this.data.endAudio, () => { this.playAudioByUrl(this.data.finishAudio, () => {
playDragonBoneAnimation(this.coolcat, 'normal', -1); playDragonBoneAnimation(this.coolcat, 'normal', -1);
}); });
} else { } else {
...@@ -366,24 +399,37 @@ cc.Class({ ...@@ -366,24 +399,37 @@ cc.Class({
}); });
}, },
updateItem() { async updateItem() {
this._submitted = false; this._submitted = false;
this.cleanColor(); this.cleanColor();
this.coolcat.active = true; this.coolcat.active = true;
// let info = this.data.items[this._index]; let spriteFrame=await this.getSpriteFrimeByUrl(this.data.bg);
// let words = info.words.split(''); let bg1=this.paint.getChildByName("bg_img");
// let answers = info.answers.split(''); // this.log("bg:"+bg1.name);
let words = 'aAcBaCbA'.split(''); bg1.getComponent(cc.Sprite).spriteFrame=spriteFrame;
let answers = '0147'.split('');
this._timeoutIds.push(setTimeout(() => { let bg2=this.paint2.getChildByName("bg_img");
this.initAlligator(this._alligator, words); bg2.getComponent(cc.Sprite).spriteFrame=spriteFrame;
}, 1));
console.log(words, answers); this._alligator.destroyAllChildren();
this._ids = answers; this._alligator2.destroyAllChildren();
this._id_count = answers.length; // this._timeoutIds.push(setTimeout(() => {
await this.initAlligator(this._alligator);
// }, 1));
this._alligator = this.bindAlligator(this.paint);
this._alligator2 = this.bindAlligator(this.paint2);
this.bindAlligatorButton(this._alligator);
// console.log(words, answers);
this._ids=[];
for(let i=0;i<this.data.images.length;i++){
this._ids[i]=i;
}
// this._ids = answers;
this._id_count = this._ids.length;
console.log(' coolcat play ') console.log(' coolcat play ')
...@@ -440,26 +486,45 @@ cc.Class({ ...@@ -440,26 +486,45 @@ cc.Class({
}, },
getSpriteFrimeByUrl(url, cb) { async getSpriteFrimeByUrl(url, cb) {
return new Promise((resolve)=>{
cc.loader.load({ url }, (err, img) => { cc.loader.load({ url }, (err, img) => {
const spriteFrame = new cc.SpriteFrame(img) const spriteFrame = new cc.SpriteFrame(img)
if (cb) { resolve(spriteFrame);
cb(spriteFrame); // if (cb) {
} // cb(spriteFrame);
// }
}) })
});
}, },
getSprNodeByUrl(url, cb) { async getSprNodeByUrl(url) {
const node = new cc.Node(); const node = new cc.Node();
const spr = node.addComponent(cc.Sprite); const spr = node.addComponent(cc.Sprite);
this.getSpriteFrimeByUrl(url, (sf) => { spr.spriteFrame=await this.getSpriteFrimeByUrl(url);
spr.spriteFrame = sf; return node;
if (cb) {
cb(node);
}
})
}, },
// getSpriteFrimeByUrl(url, cb) {
// cc.loader.load({ url }, (err, img) => {
// const spriteFrame = new cc.SpriteFrame(img)
// if (cb) {
// cb(spriteFrame);
// }
// })
// },
// getSprNodeByUrl(url, cb) {
// const node = new cc.Node();
// const spr = node.addComponent(cc.Sprite);
// this.getSpriteFrimeByUrl(url, (sf) => {
// spr.spriteFrame = sf;
// if (cb) {
// cb(node);
// }
// })
// },
playAudioByUrl(audio_url, cb = null) { playAudioByUrl(audio_url, cb = null) {
if (!audio_url) { if (!audio_url) {
cb && cb(); cb && cb();
...@@ -488,6 +553,7 @@ cc.Class({ ...@@ -488,6 +553,7 @@ cc.Class({
console.log('isCanFinish:', isCanFinish); console.log('isCanFinish:', isCanFinish);
if (isCanFinish) { if (isCanFinish) {
this.playAudioByUrl(this.data.finishAudio);
this.submitBtnClick(); this.submitBtnClick();
} }
}, },
...@@ -541,38 +607,61 @@ cc.Class({ ...@@ -541,38 +607,61 @@ cc.Class({
if (this.color_selector.active == false) if (this.color_selector.active == false)
return; return;
// console.log('area:' + sprite.t_idx);
let find_id = this._ids.indexOf(sprite.t_idx + '');
if (find_id >= 0) {
this._ids[find_id] = -1;
// if (this.btn_submit.node.active == false) {
// this.btn_submit.node.active = true;
// }
//correct //correct
playDragonBoneAnimation(this.coolcat, 'right', -1); playDragonBoneAnimation(this.coolcat, 'right', -1);
this.playAudioByName('correct', () => { this.playAudioByUrl(this.data.rightAudio,()=>{
playDragonBoneAnimation(this.coolcat, 'normal', -1); playDragonBoneAnimation(this.coolcat, 'normal', -1);
this._can_tap = true; this._can_tap = true;
});
this.playAudioByName('painted');
}
else {
//incorrect
this._can_tap = false;
playDragonBoneAnimation(this.coolcat, 'wrong', -1);
this.playAudioByName('incorrect', () => {
playDragonBoneAnimation(this.coolcat, 'normal', -1);
this._can_tap = true;
});
return;
}
this._ids[tooth.t_idx]=-1;
sprite.painted = true; sprite.painted = true;
sprite.color = this._color; sprite.color = this._color;
sprite.word.node.color = cc.Color.WHITE; // sprite.word.node.color = cc.Color.WHITE;
this.tryFinish(); this.tryFinish();
})
// this.playAudioByName('correct', () => {
// playDragonBoneAnimation(this.coolcat, 'normal', -1);
// this._can_tap = true;
// });
this.playAudioByName('painted');
// // console.log('area:' + sprite.t_idx);
// let find_id = this._ids.indexOf(sprite.t_idx + '');
// if (find_id >= 0) {
// this._ids[find_id] = -1;
// // if (this.btn_submit.node.active == false) {
// // this.btn_submit.node.active = true;
// // }
// //correct
// playDragonBoneAnimation(this.coolcat, 'right', -1);
// this.playAudioByName('correct', () => {
// playDragonBoneAnimation(this.coolcat, 'normal', -1);
// this._can_tap = true;
// });
// this.playAudioByName('painted');
// }
// else {
// //incorrect
// this._can_tap = false;
// playDragonBoneAnimation(this.coolcat, 'wrong', -1);
// this.playAudioByName('incorrect', () => {
// playDragonBoneAnimation(this.coolcat, 'normal', -1);
// this._can_tap = true;
// });
// return;
// }
// this._ids[tooth.t_idx]=-1;
// sprite.painted = true;
// sprite.color = this._color;
// // sprite.word.node.color = cc.Color.WHITE;
// this.tryFinish();
}); });
sprite._hitTest = this._hitTest.bind(this); sprite._hitTest = this._hitTest.bind(this);
......
{
"ver": "1.1.2",
"uuid": "41970e8e-5322-4f22-9782-9531f4e45289",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
import Manager from "./Manager/Manager"
import SoundMgr from "./Manager/SoundMgr"
import AssetMgr from "./Manager/AssetMgr"
import ViewMgr from "./Manager/ViewMgr"
import LayerMgr from "./Manager/LayerMgr"
import ModuleMgr from "./Manager/ModuleMgr"
import LoopMgr from "./Manager/LoopMgr"
import { EventConst } from "./ConstDefine/EventConst"
import GameUpdateMgr from "./Manager/GameUpdateMgr"
let Managers=[
LoopMgr,
AssetMgr,
LayerMgr,
SoundMgr,
ViewMgr,
ModuleMgr,
GameUpdateMgr
]
export default class AppFacade{
private static mgrDic:Map<string,Manager>=new Map()
private static mgrProgress:number=null //模块进度
private static progress:number=null //总进度
public static get Progress(){return this.progress}
private static isInitFinish:boolean=null
private static isDestroy:boolean=false
private constructor(){}
private static hideFun:any
private static showFun:any
public static onLoad(){
console.log("onLoad")
this.mgrProgress=0
this.progress=0
this.isInitFinish=false
this.isDestroy=false
this.hideFun=this.onHideGame.bind(this)
this.showFun=this.onShow.bind(this)
cc.game.on(cc.game.EVENT_SHOW, this.onShow, this)
cc.game.on(cc.game.EVENT_HIDE, this.onHideGame, this)
}
public static async onStart(){
console.log("onStart")
let counter=0
for(let mgr of Managers){
await this.addMgr(mgr as any)
this.mgrProgress=(++counter/Managers.length)
}
this.getMgr(AssetMgr).startPreLoad()
this.mgrProgress=1
}
public static onUpdate(){
if(this.isInitFinish==false){
let assetMgr=this.getMgr(AssetMgr)
let updateMgr=this.getMgr(GameUpdateMgr)
if(assetMgr){
//总进度=更新进度+模块加载进度+资源预加载进度
this.progress=(updateMgr&&updateMgr.Progress||0)*0.5+(this.mgrProgress*0.2)+(assetMgr&&assetMgr.PreProgress*0.3||0)
this.progress>=1&&(this.isInitFinish=true)
}
}else{
for(let v of this.mgrDic.values()){
v.update()
}
}
}
public static onLateUpdate(){
if(this.isDestroy) return
for(let v of this.mgrDic.values()){
v.lateUpdate()
}
}
/**
* bug:loopMgr清理了事件,最好先释放
*/
public static async onDestroy(){
cc.game.off(cc.game.EVENT_SHOW, this.onShow, this)
cc.game.off(cc.game.EVENT_HIDE, this.onHideGame, this)
this.onHideGame()
this.isDestroy=true
for(let i=0;i<this.mgrDic.size;++i){
console.log(Managers[i].TypeName)
this.mgrDic.get(Managers[i].TypeName).release()
}
this.mgrDic.clear()
}
public static getMgr<T extends Manager>(type:{new():T;TypeName:string}):T{
let res:T=<T>this.mgrDic.get(type.TypeName)
return res
}
//IManager 要求对象继承于IManager ,用Manager要求对象有一堆属性实现
//T 是最终存入的对象
private static async addMgr<T extends Manager>(type:{new():T;TypeName:string}){
let res:T=<T>this.mgrDic.get(type.TypeName)
if(!res){
res=new type()
await res.start()
this.mgrDic.set(type.TypeName,res)
}
return res
}
private static onHideGame(){
console.log("隐藏到后退或者退出")
cc.systemEvent.emit(EventConst.HideGame)
}
private static onShow(res){
cc.systemEvent.emit(EventConst.ShowGame,res)
}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "635c923c-a3a5-4520-8111-9a88754b8a87",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "01a9d787-2186-4fe7-b00b-8ac6f65d5e02",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
import AppFacade from "../AppFacade";
import LayerMgr from "../Manager/LayerMgr";
import UIUtil from "../Util/UIUtil";
import View from "./View";
/**
* @param 全屏界面
* 1.需要有Bottom Top Left Right 四个二级节点对齐
* 2.最高级父节点Size=0,0
* 3.【应该只有一级界面是Fullview,内曾是Fullview没意义,middle等节点并不会展开】
*/
export default abstract class FullView extends View{
public widget:cc.Widget=null
public top:cc.Node=null
public bottom:cc.Node=null
public left:cc.Node
public leftTop:cc.Node
public leftBottom:cc.Node
public right:cc.Node
public rightBottom:cc.Node
public rightTop:cc.Node
public middle:cc.Node
public topWidget:cc.Widget=null
public bottomWidget:cc.Widget=null
public leftWidget:cc.Widget=null
public leftTopWidget:cc.Widget
public leftBottomWidget:cc.Widget
public rightWidget:cc.Widget=null
public rightTopWidget:cc.Widget
public rightBottomWidget:cc.Widget
public middleWidth:cc.Widget=null
public abstract getTypeName():string
protected setLayer(){
let layer=AppFacade.getMgr(LayerMgr)
// widget 安装上后,left的值等没有根据父亲更新
this.widget=UIUtil.autoFitCanvas(this.node,layer.bangScreenTopOffset())
this.top=this.getChildNode("Top")
if(this.top){
this.top.setContentSize(cc.view.getDesignResolutionSize())
this.topWidget=this.addCCComp<cc.Widget>(this.top,cc.Widget)
this.topWidget.isAlignTop=true
}
this.bottom=this.getChildNode("Bottom")
if(this.bottom){
this.bottom.setContentSize(cc.view.getDesignResolutionSize())
this.bottomWidget=this.addCCComp<cc.Widget>(this.bottom,cc.Widget)
this.bottomWidget.isAlignBottom=true
}
this.left=this.getChildNode("Left")
if(this.left){
this.left.setContentSize(cc.view.getDesignResolutionSize())
this.leftWidget=this.addCCComp<cc.Widget>(this.left,cc.Widget)
this.leftWidget.isAlignLeft=true
}
this.leftTop=this.getChildNode("LeftTop")
if(this.leftTop){
this.leftTop.setContentSize(cc.view.getDesignResolutionSize())
this.leftTopWidget=this.addCCComp<cc.Widget>(this.leftTop,cc.Widget)
this.leftTopWidget.isAlignLeft=true
this.leftTopWidget.isAlignTop=true
}
this.leftBottom=this.getChildNode("LeftBottom")
if(this.leftBottom){
this.leftBottom.setContentSize(cc.view.getDesignResolutionSize())
this.leftBottomWidget=this.addCCComp<cc.Widget>(this.leftBottom,cc.Widget)
this.leftBottomWidget.isAlignLeft=true
this.leftBottomWidget.isAlignBottom=true
this.leftBottomWidget.updateAlignment()
}
this.right=this.getChildNode("Right")
if(this.right){
this.right.setContentSize(cc.view.getDesignResolutionSize())
this.rightWidget=this.addCCComp<cc.Widget>(this.right,cc.Widget)
this.rightWidget.isAlignRight=true
}
this.rightTop=this.getChildNode("RightTop")
if(this.rightTop){
this.rightTop.setContentSize(cc.view.getDesignResolutionSize())
this.rightTopWidget=this.addCCComp<cc.Widget>(this.rightTop,cc.Widget)
this.rightTopWidget.isAlignRight=true
this.rightTopWidget.isAlignTop=true
}
this.rightBottom=this.getChildNode("RightBottom")
if(this.rightBottom){
this.rightBottom.setContentSize(cc.view.getDesignResolutionSize())
this.rightBottomWidget=this.addCCComp<cc.Widget>(this.rightBottom,cc.Widget)
this.rightBottomWidget.isAlignRight=true
this.rightBottomWidget.isAlignBottom=true
}
this.middle=this.getChildNode("Middle")
if(this.middle){
this.middleWidth=UIUtil.autoFitCanvas(this.middle)
}
}
protected updateAligment(){
this.topWidget&&this.topWidget.updateAlignment()
this.bottomWidget&&this.bottomWidget.updateAlignment()
this.leftWidget&&this.leftWidget.updateAlignment()
this.leftTopWidget&&this.leftTopWidget.updateAlignment()
this.leftBottomWidget&&this.leftBottomWidget.updateAlignment()
this.rightTopWidget&&this.rightTopWidget.updateAlignment()
this.rightBottomWidget&&this.rightBottomWidget.updateAlignment()
this.rightWidget&&this.rightWidget.updateAlignment()
this.middleWidth&&this.middleWidth.updateAlignment()
}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "8b8f4199-a46f-42d9-807a-87bf0d003d43",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import { ViewConst } from "../ConstDefine/ViewConst";
import AppFacade from "../AppFacade";
import LayerMgr from "../Manager/LayerMgr";
import UIWindowView from "./UIWindowView";
import View from "./View";
export default class MaskView extends View{
//栈
private viewStack:Array<UIWindowView>=new Array()
//退出队列
private exitQueue:Array<UIWindowView>=new Array()
private newTarget:cc.Node=null
public getTypeName(): string {
return ViewConst.PauseView
}
protected setLayer(){
this.newTarget&&this.setParentData(this.newTarget)
}
protected async getChilds(){
this.node.on(cc.Node.EventType.TOUCH_END,this.onClickMask,this)
this.node.active=true
this.isOpen=true
}
/**
* @param target
* @returns 是否可以显示出来
*/
public bindTarget(target:UIWindowView){
if(!target) return
let init=this.viewStack.length<=0
this.pushStack(target)
if(init){
this.node&&(this.isOpen=true)
}
}
public unBindTarget(target:UIWindowView){
this.popStack(target)
this.tryResycle()
}
/**
* 返回是否已经存入
* @param target
*/
private pushStack(target:UIWindowView){
let lastView=this.viewStack[this.viewStack.length-1]
if(lastView==target) return
let index=this.viewStack.lastIndexOf(target)
if(index>=0){
this.viewStack.splice(index,1)
}
let preView=this.viewStack[this.viewStack.length-1]
this.viewStack.push(target)
this.setParentData(target?.node)
this.popExitQueue(target)
this.popExitQueue(preView)
if(preView){
this.exitQueue.push(preView)
preView.hide()
}
}
private popStack(target:UIWindowView) {
//只是临时退出
if(this.exitQueue.includes(target)){
return
}
let index=this.viewStack.lastIndexOf(target)
if(index>=0){
this.viewStack.splice(index,1)
}
let preView=this.exitQueue.shift()
if(preView){
preView.open()
this.setParentData(preView.node)
}
}
private popExitQueue(target:UIWindowView){
let index=this.exitQueue.lastIndexOf(target)
if(index>=0){
this.exitQueue.splice(index,1)
}
}
private setParentData(node:cc.Node){
if(!node) return
if(this.node){
this.setParent(node.parent)
this.setPosition(cc.Vec2.ZERO_R)
let sibling=node.parent?.childrenCount??0
this.node.setSiblingIndex(sibling+1)
node.setSiblingIndex(sibling)
}else{
this.newTarget=node
}
}
private onClickMask(){
// if(this.viewStack.length>0){
// let view=this.viewStack[0]
// if(view?.IsCanClickMaskClose){
// view.close()
// }
// }
// this.tryResycle()
}
public closeAll(){
let tmpStack=this.viewStack.splice(0)
this.viewStack.length=0
this.exitQueue.length=0
for(let view of tmpStack){
view?.close()
}
this.tryResycle()
}
public isInStack(view:UIWindowView):boolean{
return this.viewStack.includes(view)
}
private tryResycle(){
if(this.viewStack.length<=0){
this.exitQueue.length=0
AppFacade.getMgr(LayerMgr).pushPool(this.node)
this.isOpen=false
}
}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "afa23280-0ecb-4d13-9b0a-cdbf0391714b",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import { ViewConst, ViewType } from "../ConstDefine/ViewConst"
import AppFacade from "../AppFacade"
import LayerMgr from "..//Manager/LayerMgr"
import ViewMgr from "..//Manager/ViewMgr"
import FullView from "./FullView"
/**
* UI全屏界面
*/
export default abstract class UIFullView extends FullView{
public abstract getTypeName():string
public getViewType():ViewType{return ViewType.UIFullView}
protected setLayer(){
super.setLayer()
this.changeLayer()
}
protected changeLayer(){
let layer=AppFacade.getMgr(LayerMgr)
layer.setLayer(this.node,layer.UiLayer)
}
public close(){
super.close()
AppFacade.getMgr(ViewMgr).releaseView(this.getTypeName(),ViewConst.ReleaseTime.UI)
}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "0b4c5b38-fdae-4880-ac59-d6c7ea228412",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import View from "./View";
import AppFacade from "../AppFacade";
import LayerMgr from "../Manager/LayerMgr";
import MaskView from "./MaskView";
import LoopMgr from "../Manager/LoopMgr";
import ViewMgr from "../Manager/ViewMgr";
import { ResConst } from "../ConstDefine/ResConst";
import { ViewConst, ViewType } from "../ConstDefine/ViewConst";
/**
@param UI窗体
*/
const TWEEN_TIME=0.3
export default abstract class UIWindowView extends View{
//静态变量只有加载模块的时候调用
public static maskView:MaskView=null
private enterTween:cc.Tween=null
private exitTween:cc.Tween=null
private enterPos:cc.Vec3=cc.Vec3.ZERO
private exitPos:cc.Vec3=cc.v3(0,cc.view.getDesignResolutionSize().height)
protected btnClose:cc.Button=null
//允许点击mask关闭
public get IsCanClickMaskClose():boolean{return this.isCanClickMaskClose}
protected isCanClickMaskClose:boolean=true
private closeTimeoutId:number=-1
public abstract getTypeName():string
public getViewType():ViewType{return ViewType.UIWindow}
protected setLayer():void{
let layer=AppFacade.getMgr(LayerMgr)
layer.setLayer(this.node,layer.WindowLayer)
this.enterTween=cc.tween(this.node).to(0,{position:this.exitPos}).to(TWEEN_TIME,{position:this.enterPos},{easing:cc.easing.circInOut})
this.exitTween=cc.tween(this.node).to(0,{position:this.enterPos}).to(TWEEN_TIME,{position:this.exitPos},{easing:cc.easing.expoIn})
}
protected async getChilds(){
if(!UIWindowView.maskView){
UIWindowView.maskView=new MaskView()
UIWindowView.maskView.loadViewAsync(ResConst.UiABName,"Common/MaskView")
}
this.btnClose=this.getChildComp("BtnClose",cc.Button)
this.btnClose?.node.on("click",this.close,this)
await this.getWindowChilds()
}
/** 子类重写这个方法
* 会忘记调用 await this.getChilds()
*/
protected abstract getWindowChilds()
protected onOpenEnter(){}
/** window不能限制,影响窗口再弹 */
public open(){
super.open()
this.clearCloseTimeout()
UIWindowView.maskView?.bindTarget(this)
this.playAnimal(true)
}
public close():void{
if(this.isOpen==false) return
this.clearCloseTimeout()
UIWindowView.maskView?.unBindTarget(this)
this.playAnimal(false)
AppFacade.getMgr(ViewMgr).releaseView(this.getTypeName(),ViewConst.ReleaseTime.UI)
super.close()
// this.closeTimeoutId=AppFacade.getMgr(LoopMgr).setTimeout(()=>{
// AppFacade.getMgr(ViewMgr).releaseView(this.getTypeName(),ViewConst.ReleaseTime.UI)
// super.close()
// },TWEEN_TIME)
}
public hide(){
this.playAnimal(false)
}
public playAnimal(isEnter:boolean){
if(isEnter){
// this.exitTween?.stop()
// this.enterTween?.start()
// AppFacade.getMgr(LoopMgr).setTimeout(this.onOpenEnter.bind(this),TWEEN_TIME)
this.onOpenEnter()
}else{
// this.enterTween?.stop()
// this.exitTween?.start()
}
// AppFacade.getMgr(SoundMgr).playEffect(SoundConst.Window)
}
private clearCloseTimeout(){
AppFacade.getMgr(LoopMgr).clearTimeout(this.closeTimeoutId)
this.closeTimeoutId=-1
}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "cda9cb01-2ec6-44fb-95ec-03acf7ec70bd",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import AppFacade from "../AppFacade";
import { EventConst } from "../ConstDefine/EventConst";
import ViewComp from "../ViewComp/ViewComp";
import { ViewType } from "../ConstDefine/ViewConst";
import IView from "../Interface/IView";
import AssetMgr from "../Manager/AssetMgr";
/**
* @param 所有对象的父类
*/
export default class View implements IView {
//【禁止使用】类名会因为编译修改
private getClsName(): string {
return this.constructor.name
}
private static gIndex=0
private instanceId:number=0
public get InstanceId():number{
if(!this.instanceId){
this.instanceId=++View.gIndex
}
return this.instanceId
}
public getTypeName(): string { return "View" }
public getViewType():ViewType{ return ViewType.None}
public get node(): cc.Node { return this.rootNode }
private rootNode: cc.Node
protected isOpen: boolean
public get IsOpen(): boolean { return this.isOpen }
protected resName: string = ""
public get ResName(): string { return this.resName }
protected abPath: string = ""
protected isStarLoad:boolean=false
public get IsStartLoad():boolean{return this.isStarLoad}
protected isLoadFinish: boolean = false //用来判断是否加载完
public get IsLoadFinish():boolean{return this.isLoadFinish}
private viewComps:Map<typeof ViewComp,ViewComp>
//子类写以下方法
protected setLayer(): void { }
protected async getChilds() { }
protected async onUpdateData(data?: Object) { }
protected onOpen(): void { }
protected onClose(): void { }
/**是否可以设置active */
public isCanActiveClose:boolean=true
public isCanActiveOpen:boolean=true
public async loadViewAsync(abPath: string, resName: string) {
this.isStarLoad=true
return new Promise(async (resolve)=>{
this.resName = resName
this.abPath = abPath
try{
let prefab = await AppFacade.getMgr(AssetMgr).loadAssetAsync<cc.Prefab>(abPath, resName, cc.Prefab)
this.rootNode = cc.instantiate(prefab)
await this.loadViewFinish()
resolve(this)
}catch(err){
console.log(err)
}
})
}
public async loadViewClone(prefab: cc.Node, instantiate: boolean)
public async loadViewClone(prefab: cc.Prefab)
public async loadViewClone(prefab: any, instantiate: boolean = true) {
this.isStarLoad=true
return new Promise(async (resolve)=>{
if (!prefab) {
console.error("loadViewClone prefab is null")
return
}
this.rootNode = instantiate && cc.instantiate(prefab) || prefab
await this.loadViewFinish()
resolve(this)
})
}
protected async loadViewFinish(){
this.setLayer()
await this.getChilds()
this.viewComps?.forEach((comp)=>comp.getChilds())
this.isLoadFinish = true
}
public isRootView(): boolean { return cc.isValid(this.node) }
public isParentView(): boolean { return this.isRootView() && cc.isValid(this.node.parent) }
//防止没加载完成的时候多次调用
public async updateData(data?: Object) {
if (this.isLoadFinish == false)
return
await this.onUpdateData(data)
this.viewComps?.forEach((comp)=>comp.updateData(data))
}
public open(): void {
if (this.isLoadFinish==false||this.isOpen==true) return
this.isOpen = true
this.viewComps?.forEach((comp)=>comp.open())
if(this.isCanActiveOpen&&this.isRootView()){
this.node.active=true
}
this.isParentView() && this.node.setSiblingIndex(this.node.parent.childrenCount)
this.emitEvent(EventConst.OpenView)
this.onOpen()
}
protected emitEvent(event:string){
cc.systemEvent.emit(event,this.getTypeName(),this.getViewType())
}
public close(): void {
if (this.isOpen==false) return
this.isOpen = false
this.viewComps?.forEach((comp)=>comp.close())
if(this.isCanActiveClose&&this.isRootView()){
this.node.active=false
}
this.onClose()
this.emitEvent(EventConst.CloseView)
}
/**
* 事件在loop中释放了
*/
public release(): void {
this.onRelsese()
this.isLoadFinish = false
this.node?.destroy()
this.viewComps?.forEach((comp)=>comp.release())
AppFacade.getMgr(AssetMgr).releaseAsset(this.abPath,this.resName)
}
protected onRelsese(){}
public setActive(active:boolean){
this.isRootView()&&(this.node.active=active)
}
public setParent(parent: cc.Node) {
this.isRootView() && (this.node.parent = parent)
}
public setPosition(newPosOrX: cc.Vec2 | cc.Vec3) {
this.isRootView() && (this.node.setPosition(newPosOrX))
}
public setRotation(rotation: number) {
this.isRootView() && (this.node.angle = -rotation)
}
public getWorldPos(): cc.Vec3 {
let res = cc.Vec3.ZERO
if (this.isParentView()) {
res = this.node.parent.convertToWorldSpaceAR(this.node.position)
}
return res
}
public setWorldPos(worldPos: cc.Vec3) {
if (this.isParentView()) {
this.node.position = this.node.parent.convertToNodeSpaceAR(worldPos)
}
}
protected addViewComp(type:typeof ViewComp):ViewComp{
if(!this.viewComps){
this.viewComps=new Map()
}
let c=this.viewComps.get(type)
if(!c){
c=new type(this)
this.viewComps.set(type,c)
}
return c
}
public getViewComp<T extends ViewComp>(type:typeof ViewComp):T{
if(!this.viewComps) return
let comp=this.viewComps.get(type)
return <T>comp
}
protected getChildNode(url: string): cc.Node {
if (!this.isRootView()) return null
if (url === "") return this.node
return cc.find(url, this.node)
}
protected getChildComp<T extends cc.Component>(url: string, type: { prototype: T }): T {
if (!this.isRootView()) return null
let node = this.getChildNode(url)
!node && (cc.error(this.resName, url, "not exit", "getChildComp"))
return node && node.getComponent(type)
}
protected getChildComps<T extends cc.Component>(url: string, type: { prototype: T }): T[] {
if (!this.isRootView()) return null
let node = this.getChildNode(url)
!node && (cc.error(this.resName, url, "not exit", "getChildComp"))
return node && node.getComponentsInChildren(type)
}
protected addCCComp<T extends cc.Component>(node: cc.Node, type: new () => cc.Component): T {
if (!node) return null
let res = node.getComponent(type)
if (!res) {
res = node.addComponent(type) as T
}
return res
}
protected setName(name: string) {
this.isRootView() && (this.node.name = name)
}
public getPathInLayer():string{
if(!this.isRootView()) return ""
let p=this.node.parent
let res=this.node.name
while(cc.isValid(p)){
res=p.name+"/"+res
p=p.parent
}
return res
}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "803110d8-07ce-4d32-b11e-61b7c7efee33",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "db5f0937-64e8-4998-83b6-ddd2e1cd2869",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
export namespace AppConst{
//语言定义 Zn中文 Fan繁体 En英文
export let LangZn="CN"
export let LangFan="TC"
export let LangEn="EN"
export let Lang=LangZn
export let IsDebug=true;//false
export let IsAuto=true;//false
export let GameOptimize=false //启动优化
export let GameFrameRate=60//60帧
export let GameFrameInterval=1/GameFrameRate //减少update调用次数
export let Width=2176
export let Height=1600
export let Ip="127.0.0.1"
export let Port="8081"
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "8b93a4cd-8f62-4a53-b362-a5292ae4bc34",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
/**
* @param 事件
*/
export const EventConst = {
//输入系统
TouchStart: "TouchStart",
TouchStay: "TouchStay",
TouchEnd: "TouchEnd",
TouchCancle: "TouchCancle",
TouchMove: "TouchMove",
ChangeTouchState:"ChangeTouchState",//修改操作状态
//全局
BtnForceClickOpen: "BtnForceClickOpen",//ForceClick脚本附加事件
BtnForceClickClose: "BtnForceClickClose",//ForceClick脚本附加事件
TBCLRState: "TBCLRState",//tbclr方位界面动画状态
OpenView: "OpenView", //打开界面
CloseView: "CloseView", //关闭界面
CloseAllWindow: "CloseAllWindow",//关闭所有窗口界面
SaveDataPre: "SaveDataPre", //存档前
//游戏相关
MainMenu:"MainMenu", //进入主菜单
EnterGame: "EnterGame",//进入游戏
ShowGame:"ShowGame", //展开游戏
HideGame: "HideGame", //退出游戏
LoadingFinish: "LoadingFinish", //更新完成
LoadingShow: "LoadingShow",//进度页面
LoadingHide: "LoadingHide",//隐藏进度页面
RoleMove:"RoleMove",
//广告
TemplateViewAdStatus:"TemplateViewAdStatus0", //模板【界面】广告的状态
JumpToStartView:"JumpToStartView",//跳到开始界面
JumpToGameView:"JumpToGameView",//跳到游戏
JumpToOverView:"JumpToOverView",//跳到结算
JumpToTalentSelectView:"JumpToTalentSelectView",//跳到天赋
JumoToAttrView:"JumoToAttrView",//跳到属性
JumpToStatisticsView:"JumpToStatisticsView",//跳到总结
//debug
StartAuto:"StartAuto", //开始自动跑
SelectTalentDebug:"SelectTalentDebug",//点击天赋十连
SetAttrValueDebug:"SetAttrValueDebug",
PlayGameDebug:"PlayGameDebug",
OverViewDebug:"OverViewDebug",
//属性
AttrUpdate:"UpdateAttr",//更新属性
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "308804b0-7159-435e-91f5-6e7ed528fdd8",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
export enum SubContextEvent{
InitData="InitData",
Open="Open",
Close="Close",
SetValue="SetValue",
ReciveInvite="ReciveInvite",
}
export enum ChannelType
{
//小游戏
None,Weixin,ByteDance,Kuaishou,OPPO,VIVO,_4399,
//Android
Android,Android_Ohayoo,_233,Android_MOMOYU,
//IOS
IOS,IOS_Ohayoo,
}
export namespace PlatformConst{
//微信 start
//web可以有多个渠道,没办法区分只能赋给id
// export let Channel=ChannelType.Weixin
// export let Channel=ChannelType.ByteDance
export let Channel=ChannelType.None
//分享query数字
export let ShareQuery={
None:"0",
inviteFriend:"1", //邀请好友 给 shareMessageToFriend 用
inviteNum:"2", //邀请数量
sendDiamond:"3", //送钻石
}
export let InviteFriendDiamond=20 //邀请好友奖励
export let GiveFriendDiamond=5 //赠送好友钻石
export function getWXShareData(openId){
return {
title: '皇帝模拟器',
// imageUrlId:getPlatformShareId(),
// imageUrl: getPlatfomShareImg(),
query: "inviteOpenId=" + openId,
}
}
function getPlatformShareId():string{
if(PlatformConst.Channel==ChannelType.Weixin){
return "gkkrxQYURhaacqjt7nkPdg=="
}
}
function getPlatfomShareImg():string{
if(PlatformConst.Channel==ChannelType.Weixin){
// return "https://mmocgame.qpic.cn/wechatgame/w0jhXlUMxvQnf3I2WMFnzfetNbBgVIRTG5UVrlOFBjKRsqkpZHzCR2dDocU8GLD5/0"
return ""
}
}
/** appId */
export function getAppKey():string{
if(PlatformConst.Channel==ChannelType.OPPO){
return "24em7kOC6t40k4Cs040ScgWWK"
}else if(PlatformConst.Channel==ChannelType.VIVO){
return "61506548aa5cab5f8803ed3f8d422a9a"
}
}
export function getAppSecrete():string{
if(PlatformConst.Channel==ChannelType.OPPO){
return "E2cdf7a3773b646EbcD77Bd6eec2A947"
}else if(PlatformConst.Channel==ChannelType.VIVO){
return "d1f2afc75fc0b36ff22af3159744edf6"
}
}
export function getPkgName():string{
if(PlatformConst.Channel==ChannelType.OPPO){
return "gzyy.msyx.nearme.gamecenter"
}else if(PlatformConst.Channel==ChannelType.VIVO){
return "com.gzyy.msyx.vivominigame"
}
}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "bd4cfa23-db06-4478-bb95-f34967f16c0d",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
//资源相关常量
export namespace ResConst{
export let emptyABName="";
export let AudioABName="res/audio"
export let PrefabsABName="prefabs"
export let JsonABName="json"
export let Role1ABName="role1"
export let UiABName="UI"
export let AiABName="Ai"
export let ConfigABName="config"
export let ResourcesABName="resources"
export let ParticleABName="Particle"
export let SpineABName="Spine"
export let SkillSVGName="skill"
export let snd={
button:"button",
click:"click",
right:"correct",
wrong:"incorrect",
lack:"lack",
finish:"finish",
painted:"painted"
}
//必须加载完
export const AwaitLoadAssets=[
]
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "a523a2f0-b168-4822-a6b9-69a4c7fea0c3",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
export enum ViewType{
None=0,
UI=1<<0,
UIWindow=(1<<1)|UI,
UIFullView=(1<<2)|UI,
UITabView=(1<<3)|UIWindow,
SceneView=(1<<4),
}
export namespace ViewType{
export function isUI(viewType:ViewType){
let res=viewType&ViewType.UI
return res==ViewType.UI
}
export function isUIWindow(viewType:ViewType){
let res=viewType&ViewType.UIWindow
return res==ViewType.UIWindow
}
export function isScene(viewType:ViewType){
let res=viewType&ViewType.SceneView
return res==ViewType.SceneView
}
}
export namespace ViewConst{
//释放时间
export const ReleaseTime={
UI:5,
Particle:8,
SceneObj:10,
}
//View
export const TipsView="TipsView"
//SceneView
export const MenuView="bg"
//UIWindow
export const CardView="CardView"
export const PauseView="PauseView"
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "37363f43-0b03-46fb-9a8c-bb40d7df82c6",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import AppFacade from "./AppFacade";
import ViewMgr from "./Manager/ViewMgr";
import View from "./BaseView/View";
import IController from "./Interface/IController";
//controller操作数据model和view
export default class Controller implements IController{
protected constructor(){}
protected static _inst=null
public static get Inst():Controller{
if(this._inst==null){
this._inst=new Controller()
}
return this._inst
}
public async init() {}
public release() {}
// public async getView(viewName:string,type:typeof View){
// let view=AppFacade.getMgr(ViewMgr).openView(viewName,type)
// if(!view.IsStartLoad){
// await view.loadViewClone(cc.find("Canvas/"+viewName),false);
// }
// }
public async getView(viewName:string,type:typeof View){
let view=AppFacade.getMgr(ViewMgr).openView(viewName,type)
if(!view.IsStartLoad){
await view.loadViewClone(cc.find("Canvas/"+viewName),false);
}
// await view.updateData()
// view.open()
return view;
}
// public async getView(viewName:string,type:typeof View,resName:string){
// let view=AppFacade.getMgr(ViewMgr).openView(viewName,type)
// if(!view.IsStartLoad){
// await view.loadViewAsync(ResConst.PrefabsABName,resName)
// }
// // await view.updateData()
// // view.open()
// return view;
// }
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "4fa632b5-6def-4037-836c-32d36b5e46d0",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "9846b613-68a1-44c2-b47a-bb94057036f7",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
/**
* @param 函数接口
*/
export interface ICreateFunc<T>{
():T
}
export interface IPredicate<T>{
(t:T):boolean
}
export interface IParamter<T>{
(t:T,i?:number):void
}
export interface ILimitFunc{
(arr:any,i:number):void
}
{
"ver": "1.0.8",
"uuid": "f5debb73-a049-43ff-bd2f-32bb61c2c649",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
export default interface IController{
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "28e09d98-3a46-47f8-a4d3-946ed3c4f5f2",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "a9a8a69e-85a0-44f6-a377-b46717032148",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
export default interface IModel{
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "4e08a9fd-23e6-4de8-966e-14be66928679",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
export default interface IView{
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "53428666-7299-4b1a-94c2-a1b5ebf9481a",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import { MyCocosSceneComponent } from "../MyCocosSceneComponent";
import AppFacade from "./AppFacade";
const {ccclass, property} = cc._decorator;
//启动动态图集 必须放这里
cc.macro.CLEANUP_IMAGE_CACHE = false
cc.dynamicAtlasManager.enabled = true
@ccclass
export default class Main extends MyCocosSceneComponent {
addPreloadImage() {
AppFacade.onLoad()
}
onLoadEnd(){
try {
AppFacade.onStart()
} catch (err) {
cc.error("运行出错", err)
}
}
// onLoad(): void {
// AppFacade.onLoad()
// }
// start () {
// try{
// AppFacade.onStart()
// }catch(err){
// cc.error("运行出错",err)
// }
// }
update(){
try{
AppFacade.onUpdate()
}catch(err){
cc.error("运行错误",err)
}
}
lateUpdate(){
AppFacade.onLateUpdate()
}
onDestroy(){
AppFacade.onDestroy()
}
}
{
"ver": "1.0.8",
"uuid": "bf6d8a0d-d989-49fe-a23d-19ec171e58fe",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "b06e0643-fca0-4540-ad36-176d2cee4e94",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
import { ResConst } from "../ConstDefine/ResConst"
import Manager from "./Manager"
export default class AssetMgr extends Manager {
static get TypeName(): string { return "AssetMgr" }
private preProgress: number = 0
public get PreProgress(): number { return this.preProgress }
public async start() {
console.log("AssetMgr onStart")
}
public release() {
console.log("AssetMgr onRelease")
}
public async startPreLoad() {
let promises = []
for (let v of ResConst.AwaitLoadAssets) {
promises.push(this.preLoadAsset(v[0], v[1]))
}
await Promise.all(promises)
this.preProgress = 1
// this.startNoAwaitLoad()
}
// private startNoAwaitLoad() {
// this.preLoadAsset(ResConst.UiABName, "Scene/SceneObj/Player", cc.Prefab)
// this.preLoadAsset(ResConst.UiABName, "Menu/MenuView", cc.Prefab)
// this.preLoadAsset(ResConst.UiABName, "Bg/BgView", cc.Prefab)
// }
// private allProgress() {
// return ResConst.AwaitLoadAssets.length
// }
/**
* 预加载不需要等待
*/
public async preLoadAsset(abName: string, resName: string, type?: typeof cc.Asset) {
return new Promise<void>((resolve, reject) => {
cc.assetManager.loadBundle(abName, (err, bundle: cc.AssetManager.Bundle) => {
if (!err) {
bundle.preload(resName, type, (err, items) => {
resolve()
})
} else {
reject()
}
})
})
}
/**
* 预加载不需要等待
* ""表示整个目录
*/
public preLoadAssetDir(abName: string, dir: string = "", type: typeof cc.Asset) {
cc.assetManager.loadBundle(abName, (err, bundle: cc.AssetManager.Bundle) => {
if (!err) {
bundle.preloadDir(dir, type, (err, items) => { })
}
})
}
//读取目录下所有类型文件
public loadAssetDirAsync<T extends cc.Asset>(abName: string, type: typeof cc.Asset = cc.Asset): Promise<T[]> {
return new Promise((resolve, reject) => {
cc.assetManager.loadBundle(abName, (err, bundle) => {
if (err) {
cc.error("loadBundleAsync error", abName, err)
reject(err)
} else {
bundle.loadDir("./",type,(err,assets)=>{
if (err) {
cc.error("loadAssetAsync error")
reject(err)
}
else {
// assets?.addRef()
resolve(<T[]>assets)
}
})
}
})
})
}
public loadAssetAsync<T extends cc.Asset>(abName: string, resName: string, type: typeof cc.Asset = cc.Asset): Promise<T> {
return new Promise((resolve, reject) => {
cc.assetManager.loadBundle(abName, (err, bundle) => {
if (err) {
cc.error("loadBundleAsync error", abName, resName, err)
reject(err)
} else {
bundle.load(resName, type,
//complete
(err, assets) => {
if (err) {
cc.error("loadAssetAsync error", resName)
reject(err)
}
else {
// assets?.addRef()
resolve(<T>assets)
}
})
}
})
})
}
public releaseAsset(asset: cc.Asset, _?)
public releaseAsset(abName: string, resName: string)
public releaseAsset(a1: any, a2: any) {
if (a1 instanceof cc.Asset) {
if (cc.isValid(a1)) {
a1?.decRef()
}
} else {
if (!a1 || !a2) return
let ab = cc.assetManager.getBundle(a1)
let info: Record<string, any> = ab.getInfoWithPath(a2)
let uuid = info?.uuid
let asset = cc.assetManager.assets?.get(uuid)
asset?.decRef()
if (asset?.refCount <= 0) {
// console.log("释放",asset?.name,cc.assetManager.assets?.count)
}
}
}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "6c69587a-b010-4680-921e-1822c7b70123",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
class EventInfo{
public constructor(public callback:Function,public target?:any){}
}
export default class EventMgr{
private static _infoMap:Map<string,Array<EventInfo>>=new Map()
public static on(key:string,cb:Function,target?:any){
let arr=this._infoMap.get(key)
if(!arr){
arr=new Array()
this._infoMap.set(key,arr)
}
arr.push(new EventInfo(cb,target))
}
public static off(key:string,cb:Function,target?:any){
let arr=this._infoMap.get(key)
if(!arr) return
for(let i=arr.length-1;i>=0;i--){
let info=arr[i]
if(target){
if(info.callback==cb&&info.target==target){
arr.splice(i)
}
}else{
if(info.callback==cb){
arr.splice(i)
}
}
}
}
public static emit(key:string,arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any){
let arr=this._infoMap.get(key)
if(!arr||arr.length<=0) return
for(let info of arr){
info?.callback?.call(info?.target,arg1,arg2,arg3,arg4,arg5)
}
}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "bf77ba53-2ee7-4988-8735-7267f3435cd0",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import Manager from "./Manager";
import { EventConst } from "../ConstDefine/EventConst";
import { ChannelType, PlatformConst } from "../ConstDefine/PlatformConst"
//负责游戏更新
export default class GameUpdateMgr extends Manager {
static get TypeName(): string { return "GameUpdateMgr" }
private progress: number = null
public get Progress(): number { return this.progress }
public async start() {
console.log("开始更新...")
this.progress = 0
this.startUpdate()
this.onUpdateFinish()
console.log("更新完成...")
}
public release() {
}
//检测资源
private async startUpdate() {
return new Promise<void>((resovle)=>{
if (PlatformConst.Channel==ChannelType.Weixin||PlatformConst.Channel==ChannelType.ByteDance) {
const mgr = wx.getUpdateManager()
console.log("onCheckForUpdate",mgr)
if (mgr) {
mgr.onCheckForUpdate((res) => {
// 请求完新版本信息的回调
if (res.hasUpdate) {
//如果内存卡有存储游戏相关的离线文件,在更新版本的时候需要清除,避免废文件越来越多
wx.showToast({ icon: "none", title: "有新版本了,正在下载中..", duration: 600000 });//10分钟
}else{
resovle()
}
})
mgr.onUpdateFailed(function () {
wx.hideToast()
wx.showModal({
content: '新版本下载失败了,点击确定重启游戏',
title: '更新提示',
showCancel: false,
success: function (res) {
wx.exitMiniProgram()
resovle()
}
})
console.log("onUpdateFailed")
})
mgr.onUpdateReady(function () {
wx.hideToast();
wx.showModal({
content: '新版本已经准备好了,点击确定重启应用',
title: '更新提示',
showCancel: false,
success: function (res) {
// if (res.confirm) {
// // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
// mgr.applyUpdate()
// }else{
// }
mgr.applyUpdate()
resovle()
}
})
console.log("onUpdateReady")
})
}else{
resovle()
}
}
else{
resovle()
}
})
}
private onUpdateFinish(): void {
this.progress = 1
cc.systemEvent.emit(EventConst.LoadingFinish)
}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "30c38aed-87fd-4038-acae-d198e771fbcf",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import { AppConst } from "../ConstDefine/AppConst"
import UIUtil from "../Util/UIUtil"
import Manager from "./Manager"
/**
* @params 管理分辨率 层级
*/
const PoolLayer = "PoolLayer"
const WindowLayer="WindowLayer"
const BangScreenOffSet = 70
const FAR_POS = cc.v3(-10000, -10000)
export default class LayerMgr extends Manager {
static get TypeName(): string { return "LayerMgr" }
private uiRoot: cc.Node = null
public get UIRoot(): cc.Node { return this.uiRoot }
private root: cc.Node
public get Root(): cc.Node { return this.root }
//对象池池层级
private poolLayer: cc.Node = null
public get PoolLayer() { return this.poolLayer }
//场景层start
//背景图
private sceneBackLayer: cc.Node = null
public get SceneBackLayer() { return this.sceneBackLayer }
//场景层
private sceneLayer: cc.Node = null
public get SceneLayer() { return this.sceneLayer }
//场景底层
private sceneTopLayer: cc.Node
public get SceneTopLayer() { return this.sceneTopLayer }
//场景层end
//ui层start
//飘血
private flybllodLayer: cc.Node = null
public get FlybllodLayer() { return this.flybllodLayer }
private uiLayer: cc.Node = null
//ui图标层
public get UiLayer() { return this.uiLayer }
//窗口
private windowLayer: cc.Node = null
public get WindowLayer() { return this.windowLayer }
private windowTopLayer: cc.Node = null
public get WindowTopLayer() { return this.windowTopLayer }
//广播
private broadcastLayer: cc.Node = null
public get BroadcastLayer() { return this.broadcastLayer }
//弹窗
private tipViewLayer: cc.Node = null
public get TipViewLayer() { return this.tipViewLayer }
//引导
private guideLayer: cc.Node = null
public get GuideLayer() { return this.guideLayer }
//顶层
private topLayer: cc.Node = null
public get TopLayer() { return this.topLayer }
//ui层end
private layers: cc.Node[] = null
private index: number = 1
private uiViews: Array<cc.Node> = null
public async start() {
// cc.view.enableAutoFullScreen(false)
this.uiRoot = cc.find("Canvas")
cc.game.addPersistRootNode(this.uiRoot)
this.root = cc.find("Root")
if(this.root){
cc.game.addPersistRootNode(this.root)
}
else
{
this.root=this.uiRoot;
}
// 小程序设置无效
// let screen=cc.view.getFrameSize()
// cc.view.setFrameSize(screen.width*0.5,screen.height*0.5)
//手机设备和pc返回的不一样【神经病,pc返回width/height,应该是height/widg】
//let cRatio=cc.view.getDevicePixelRatio()
// let policy = this.isFitWidth() && cc.ResolutionPolicy.FIXED_WIDTH || cc.ResolutionPolicy.FIXED_HEIGHT
// // cc.view.setDesignResolutionSize(720, 1280, policy)
// cc.view.setDesignResolutionSize(AppConst.Width, AppConst.Height, policy)
this.initSize();
this.layers = new Array()
this.createLayers()
this.uiViews = [this.flybllodLayer, this.uiLayer, this.windowLayer, this.windowTopLayer, this.tipViewLayer, this.guideLayer, this.topLayer]
console.log("LayerMgr onStart")
}
_designSize = null; // 设计分辨率
_frameSize = null; // 屏幕分辨率
_mapScaleMin = null; // 场景中常用缩放(取大值)
_mapScaleMax = null; // 场景中常用缩放(取小值)
_cocosScale = null; // cocos 自缩放 (较少用到)
initSize() {
// 注意cc.winSize只有在适配后(修改fitHeight/fitWidth后)才能获取到正确的值,因此使用cc.getFrameSize()来获取初始的屏幕大小
let screen_size = cc.view.getFrameSize().width / cc.view.getFrameSize().height
let design_size = cc.Canvas.instance.designResolution.width / cc.Canvas.instance.designResolution.height
let f = screen_size >= design_size
cc.Canvas.instance.fitHeight = f
cc.Canvas.instance.fitWidth = !f
const frameSize = cc.view.getFrameSize();
this._frameSize = frameSize;
this._designSize = cc.view.getDesignResolutionSize();
let sx = cc.winSize.width / frameSize.width;
let sy = cc.winSize.height / frameSize.height;
this._cocosScale = Math.min(sx, sy);
sx = frameSize.width / this._designSize.width;
sy = frameSize.height / this._designSize.height;
this._mapScaleMin = Math.min(sx, sy) * this._cocosScale;
this._mapScaleMax = Math.max(sx, sy) * this._cocosScale;
cc.director['_scene'].width = frameSize.width;
cc.director['_scene'].height = frameSize.height;
}
public release() {
console.log("LayerMgr onRelease")
this.uiViews.length = 0
if (cc.isValid(this.uiRoot)) {
this.uiRoot.destroyAllChildren()
}
this.uiRoot = null
this.layers.length = 0
this.index = 1
}
private createLayers(): void {
this.poolLayer = this.createLayer(PoolLayer, cc.v2(-100000, -100000))
//场景层
this.sceneBackLayer = this.createLayer("SceneBackLayer")
this.sceneLayer = this.createLayer("SceneLayer")
this.sceneTopLayer = this.createLayer("SceneTopLayer")
//ui层
this.flybllodLayer = this.createLayer("FlybllodLayer")
this.uiLayer = this.createLayer("UiLayer")
this.windowLayer = this.createLayer(WindowLayer)
this.windowTopLayer = this.createLayer("WindowTopLayer")
this.broadcastLayer = this.createLayer("BroadcastLayer")
this.tipViewLayer = this.createLayer("TipViewLayer")
this.guideLayer = this.createLayer("GuideLayer")
this.topLayer = this.createLayer("TopLayer")
}
private createLayer(layerName: string, pos: cc.Vec2 = cc.Vec2.ZERO): cc.Node {
let node = new cc.Node(layerName)
this.layers.push(node)
node.setParent(this.uiRoot)
if (layerName != PoolLayer) {
UIUtil.autoFitCanvas(node)
}
node.setSiblingIndex(this.index++)
node.setPosition(pos)
return node
}
/**
* setSiblingIndex 设置同节点层级排序
* zIndex和zOrder是同一个东西。设置渲染顺序,只能影响同一级节点
* 节点渲染都是先渲染自己再渲染子节点
*/
public setLayer(node: cc.Node, layer: cc.Node, offset: number = -1) {
if (!cc.isValid(node)) return
node.parent = layer
node.setSiblingIndex(layer.childrenCount + offset)
}
public pushPool(node: cc.Node) {
if (!cc.isValid(node)) return
node.setParent(this.poolLayer)
node.setPosition(FAR_POS)
}
/**
* @param 是否是刘海屏幕
*/
public isHasBangScreen() {
return this.getDeviceRatio() >= 2
}
/**
* @param 刘海屏偏移
*/
public bangScreenTopOffset(): number {
if (this.isHasBangScreen()) {
return BangScreenOffSet
}
return 0
}
/**
* //手机设备和pc返回的不一样【神经病,pc返回width/height,应该是height/widg】
//let cRatio=cc.view.getDevicePixelRatio()
*/
public getDeviceRatio(): number {
let size = cc.view.getFrameSize()
let ratio = Math.max(size.height, size.width) / Math.min(size.height, size.width)
return ratio
}
public findNode(path: string): cc.Node {
return cc.find(path, this.uiRoot)
}
/**
* uiViews 中的是ui界面,永远显示在屏幕上
*/
public foreverShowUiView(cameraLocPos: cc.Vec3) {
for (let view of this.uiViews) {
view.position = cameraLocPos
}
}
//适配后的分辨率 用cc.winSize就可以了
public getFitedSceneResolution(): cc.Size {
return this.sceneLayer.getContentSize()
}
/** 是否是宽度适配 */
public isFitWidth(): boolean {
let cRatio = this.getDeviceRatio()
let dsize = cc.view.getDesignResolutionSize()
let dRatio = dsize.height / dsize.width
let isFitWidth = cRatio > dRatio
return isFitWidth
}
//全屏特效需要适配屏幕
public fitScreen(node: cc.Node) {
if (!node?.isValid) return
let cRatio = this.getDeviceRatio()
let dsize = cc.view.getDesignResolutionSize()
let dRatio = dsize.height / dsize.width
let paramScale = node.scale || 1
if (this.isFitWidth()) {
node.scale = paramScale * (cRatio / dRatio)
} else {
node.scale = paramScale * (dRatio / cRatio)
}
}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "04d4d6d3-121e-4d8b-8a7a-f0f720fc5958",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import { AppConst } from "../ConstDefine/AppConst";
import { EventConst } from "../ConstDefine/EventConst";
import { ILimitFunc } from "../Interface/FuncInterface";
import Manager from "./Manager";
/**
* @param js自带的interval和timeout不好管理容易造成内存泄露尽量不要使用
*/
class TimeoutInfo {
constructor(public func: Function, public timer: number, public id: number = -1) { }
}
class InterInfo {
constructor(public func: Function, public interval: number, public id: number = -1, public timer = 0) { }
}
class DelayInfo {
constructor(public func: Function, public couter: number = 0) { }
}
class LimitInfo {
constructor(public iterator: ILimitFunc, public arr: Array<any>, public limit: number, public resolve: any, public reject: any, public running: number = 0) { }
}
export default class LoopMgr extends Manager {
static get TypeName(): string { return "LoopMgr" }
private updateDic: Map<number, Function> = new Map()
private fixedDic: Map<number, Function> = new Map()
private lateUpdateDic: Map<number, Function> = new Map()
private timeoutDic: Map<number, TimeoutInfo> = new Map()
private intervalDic: Map<number, InterInfo> = new Map()
private delayOneFrames: Array<DelayInfo> = new Array()
private updateFramer: number = 0
private fixedNowTime: number = 0
private limitDic: Map<number, LimitInfo> = new Map()
private deleteLimits: Array<number> = new Array()
private framer: number = 0
public get Frame(): number { return this.framer }
private static LoopIndex: number = 0
async start() {
console.log("LoopMgr onStart")
}
public release() {
console.log("LoopMgr onRelease")
this.updateDic.clear()
this.lateUpdateDic.clear()
this.fixedDic.clear()
this.limitDic.clear()
for (let v of this.intervalDic) {
if (v[1].id != -1) {
clearInterval(v[1].id)
}
}
for (let v of this.timeoutDic) {
if (v[1].id != -1) {
clearTimeout(v[1].id)
}
}
this.intervalDic.clear()
this.timeoutDic.clear()
LoopMgr.LoopIndex = 0
this.clearEvents()
cc.Tween.stopAll()
this.updateFramer = 0
this.fixedNowTime = 0
}
public update(): void {
this.framer = (++this.framer) % Number.MIN_SAFE_INTEGER
//fixedupdate
this.fixedNowTime += cc.director.getDeltaTime()
let delta = AppConst.GameFrameRate
while (this.fixedNowTime > delta) {
this.fixedDic.forEach((v) => { v && v() })
this.fixedNowTime -= delta
}
//update
if (this.isCanUpdate()) {
this.updateDic.forEach((v, key) => { v && v() })
this.runLimit()
}
}
public lateUpdate(): void {
//lateupdate不优化,一定每帧执行的才放这里
this.lateUpdateDic.forEach((v) => { v() })
let v: DelayInfo = null
for (let i = this.delayOneFrames.length - 1; i >= 0; --i) {
v = this.delayOneFrames[i]
if (v.couter >= 1) {
v.func && v.func()
this.delayOneFrames.splice(i, 1)
}
}
this.delayOneFrames.forEach((v) => { v.couter++ })
}
//-----------------------------公开外部方法start--------------------------------
/**
* 分帧执行await async第一次会等待回调返回,之后就直接执行
* @param arr
* @param iterator 每帧如何迭代arr
* @param limit 每帧最多执行多少次
*/
public async eachLimit(arr: Array<any>, iterator: ILimitFunc, limit: number) {
return new Promise((resolve, reject) => {
let info = new LimitInfo(iterator, arr, limit, resolve, reject)
this.limitDic.set(LoopMgr.LoopIndex++, info)
})
}
public addUpdate(func: Function): number {
let id = LoopMgr.LoopIndex++
this.add(id, func, this.updateDic)
return id
}
public remvoeUpdate(id: number) {
this.remove(id, this.updateDic)
}
public addFixedUpdate(func: Function): number {
let id = LoopMgr.LoopIndex++
this.add(id, func, this.fixedDic)
return id
}
public removeFixed(id: number) {
this.remove(id, this.fixedDic)
}
public addLateUpdate(func: Function): number {
let id = LoopMgr.LoopIndex++
this.add(id, func, this.lateUpdateDic)
return id
}
public removeLateUpdate(id: number) {
this.remove(id, this.lateUpdateDic)
}
public setTimeout(func: Function, second: number): number {
let tinfo = new TimeoutInfo(func, second)
tinfo.id = setTimeout(func, second * 1000)
this.timeoutDic.set(tinfo.id, tinfo)
return tinfo.id
}
/**
* 等待多少秒,0会间隔一帧
* 用于协程
*/
public async waitForTime(second: number) {
return new Promise<number>((resolve) => {
let id=this.setTimeout(() => {
resolve(id)
}, second)
})
}
public clearTimeout(id: number) {
if (id < 0) return
clearTimeout(id)
if(this.timeoutDic.has(id)){
this.timeoutDic.delete(id)
}
}
public clearInterval(id: number) {
if (id <0) return
if(this.intervalDic.has(id)){
this.intervalDic.delete(id)
}else{
console.error("clearInterval 不存在的id")
}
clearInterval(id)
}
public setInterval(func: Function, second: number) {
let tinfo = new InterInfo(func, second)
tinfo.id = setInterval(func, second * 1000)
this.intervalDic.set(tinfo.id, tinfo)
return tinfo.id
}
public delayOneFrame(func: Function) {
this.delayOneFrames.push(new DelayInfo(func))
}
//-----------------------------公开外部方法start--------------------------------
private add(id: number, func: Function, map: Map<number, Function>) {
if (map.has(id)) return
map.set(id, func)
}
private remove(id: number, map: Map<number, Function>) {
map.delete(id)
}
private clearEvents() {
for (let v in EventConst) {
cc.systemEvent.removeAll(v)
}
}
/**
* 隔帧执行
*/
private isCanUpdate(): boolean {
if (AppConst.GameFrameInterval <= 0) return true
this.updateFramer--
if (this.updateFramer <= 0) {
this.updateFramer = AppConst.GameFrameInterval
return true
}
return false
}
/**
* await async在分帧没意义,await卡几十帧,之后一帧就被执行完了
*/
private runLimit() {
this.deleteLimits.length = 0
for (const [key, info] of this.limitDic.entries()) {
let i = 0
while (info.running < info.arr.length && i < info.limit) {
info.iterator(info.arr[info.running], info.running)
info.running++
i++
}
if (info.running >= info.arr.length) {
this.deleteLimits.push(key)
info.resolve()
}
}
this.deleteLimits.forEach((key) => {
this.limitDic.delete(key)
})
}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "6f857b7e-6dec-4234-aba5-6bac9c9184fc",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import IManager from "../Interface/IManager";
export default abstract class Manager implements IManager{
//注释父类的的TypeName让编译器自动检查子类提示
//static get TypeName(): string{return "Manager"}
async start(){}
update():void{}
lateUpdate():void{}
release(){}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "d98090ce-fe3a-4842-9124-fc68f61dfdbe",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import MenuController from "../../Game/MenuController";
import Controller from "../Controller";
import Manager from "./Manager";
export let InitModules=[
MenuController
]
export default class ModuleMgr extends Manager{
static get TypeName():string{return "ModuleMgr"}
private modules:Array<Controller>=null
public async start(){
console.log("开始初始化模块")
this.modules=new Array()
let modules=InitModules
let promises=[]
for(let mod of modules){
this.modules.push(mod.Inst)
promises.push(mod.Inst.init())
}
await Promise.all(promises)
console.log("ModuleMgr")
}
public release(){
console.log("ModuleMgr onRelease")
for(let mod of this.modules.reverse()){
mod.release()
}
this.modules.length=0
}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "8e11150f-b79e-41e3-b05f-05edc4192642",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import Manager from "./Manager";
import AppFacade from "../AppFacade";
import AssetMgr from "./AssetMgr";
import { ResConst } from "../ConstDefine/ResConst";
import LoopMgr from "./LoopMgr";
import MathUtil from "../Util/MathUtil";
import GameUtil from "../Util/GameUtil";
import { EventConst } from "../ConstDefine/EventConst";
const ValidID=-1
class Info{
constructor(public res: string, public Id: number = ValidID, public loop: boolean = true, public volume: number = 1) { }
}
export default class SoundMgr extends Manager{
static get TypeName(): string{return "SoundMgr"}
private musicDic:Map<string,Info>=new Map()
private effectDic:Map<string,Info>=new Map()
private tmpMusic:Info
private effectResDic:Map<string,cc.AudioClip>=new Map()
async start(){
this.initSoundDB()
this.playStartMusic()
console.log("SoundMgr")
cc.systemEvent.on(EventConst.ShowGame,this.onShowGame,this)
cc.systemEvent.on(EventConst.HideGame,this.onHideGame,this)
}
public release(){
console.log("SoundMgr onRelease")
this.stopAllMusic()
this.stopTmpMusic()
this.musicDic.clear()
this.effectResDic.clear()
this.tmpMusic=undefined
cc.systemEvent.off(EventConst.ShowGame,this.onShowGame,this)
cc.systemEvent.off(EventConst.HideGame,this.onHideGame,this)
}
private onHideGame(){
cc.log("cocos隐藏游戏")
// cc.audioEngine.pauseAll()
}
private onShowGame(){
cc.log("cocos显示游戏")
// cc.audioEngine.resumeAll()
}
private initSoundDB() {
}
private playStartMusic(){
}
public tryChangeMusic(isOpen:boolean){
cc.log("改变声音状态",isOpen)
if(isOpen){
// this.IsMusicOpen&&this.resumAllMusic()
cc.audioEngine.resumeAll()
}else{
cc.audioEngine.pauseAll()
}
}
//播放URL的音乐
public async playMusicByUrl(resName: string, volume: number = 1, loop: boolean = true) {
let info: Info = this.musicDic.get(resName)
if (!info) {
info = new Info(resName)
//不循环的没必要加如缓存
loop && this.musicDic.set(resName, info)
info.loop = loop
info.volume = volume
}
let audio = await this.loadResByUrl(resName) as cc.AudioClip;
if (audio) {
info.Id = cc.audioEngine.play(audio, loop, volume)
cc.log("播放音乐", resName)
}
}
//播放场景中的音乐
public async playResMusic(resName:string,volume:number=1,loop:boolean=true){
let info:Info=this.musicDic.get(resName)
if(!info){
info=new Info(resName)
//不循环的没必要加如缓存
loop&&this.musicDic.set(resName,info)
info.loop=loop
info.volume=volume
}
let audio = this.loadResClone(resName);
if (audio) {
info.Id = cc.audioEngine.play(audio, loop, volume)
cc.log("播放音乐", resName)
}
}
/**
* 播放音乐,可以同时播放多个音乐
* @param resName
* @param volume
* @param loop
*/
public async playMusic(resName:string,volume:number=1,loop:boolean=true){
let info:Info=this.musicDic.get(resName)
if(!info){
info=new Info(resName)
//不循环的没必要加如缓存
loop&&this.musicDic.set(resName,info)
info.loop=loop
info.volume=volume
}
let audio = await this.loadResAsync(ResConst.AudioABName, resName)
if (audio) {
info.Id = cc.audioEngine.play(audio, loop, volume)
cc.log("播放音乐", resName)
}
}
/**
* 播放临时音乐,不会被记录下来musicDic
* @param resName
* @param volume
* @param loop
* @param resume 播放结束自动切回背景音乐吗
*/
public async playTmpMusic(resName:string,volume:number=1,loop:boolean=true,resume:boolean=false){
if(this.tmpMusic){
this.stopTmpMusic()
}
this.tmpMusic=new Info(resName)
let audio=await this.loadResAsync(ResConst.AudioABName,"Bgm/"+resName)
let musicTime=0
if(audio){
this.tmpMusic.loop=loop
this.tmpMusic.volume=volume
this.tmpMusic.Id=cc.audioEngine.play(audio,loop,volume)
musicTime=audio.duration
}
if(resume&&musicTime>0){
AppFacade.getMgr(LoopMgr).setTimeout(()=>{
this.resumAllMusic()
},musicTime)
}
}
public stopTmpMusic(){
if(!this.tmpMusic) return
if(this.tmpMusic.Id!=ValidID){
cc.audioEngine.stop(this.tmpMusic.Id)
}
this.tmpMusic=null
}
public async resumAllMusic(){
for(let v of this.musicDic){
let info=v[1]
await this.playMusic(info.res,info.volume,info.loop)
}
}
public stopAllMusic(){
cc.audioEngine.stopAll()
}
public stopMusic(resName:string){
let info = this.musicDic.get(resName)
this.musicDic.delete(resName)
if(info&&info.Id!=ValidID){
cc.audioEngine.stop(info.Id)
}
}
//一套音效随机播放一个
public playEffectR(resName:string[],volume:number=1){
let i=MathUtil.randInt(resName.length)
this.playEffect(resName[i],0,volume)
}
public playEffect(resName:string,delay:number=0,volume:number=1,isLoop:boolean=false){
if(GameUtil.isStringEmpty(resName)) return
if (delay > 0) {
AppFacade.getMgr(LoopMgr).setTimeout(this._playEffect.bind(this, resName, volume), delay)
} else {
this._playEffect(resName, volume, isLoop)
}
}
public stopEffect(resName:string){
if(GameUtil.isStringEmpty(resName)) return
let info=this.effectDic.get(resName)
if(info){
cc.audioEngine.stopEffect(info.Id)
this.effectDic.delete(resName)
}
}
//播放URL的音效
public async playEffectByUrl(resName: string, delay: number = 0, volume: number = 1, isLoop: boolean = false) {
this.stopAllMusic();
let audio = await this.loadResEffectByUrl(resName)
if (audio) {
let id = cc.audioEngine.play(audio, isLoop, volume)
//长期循环播放才保存
if (isLoop) {
let info = new Info(resName, id, isLoop, volume)
this.effectDic.set(resName, info)
}
}
}
//播放场景中的音效
public playResEffect(resName:string,delay:number=0,volume:number=1,isLoop:boolean=false){
this.stopAllMusic();
let audio=this.loadResEffectClone(resName)
if(audio){
let id=cc.audioEngine.play(audio,isLoop,volume)
//长期循环播放才保存
if(isLoop){
let info=new Info(resName,id,isLoop,volume)
this.effectDic.set(resName,info)
}
}
}
private async _playEffect(resName:string,volume:number=1,isLoop:boolean=false){
let audio=await this.loadEffectAsync(resName)
if(audio){
let id=cc.audioEngine.play(audio,isLoop,volume)
//长期循环播放才保存
if(isLoop){
let info=new Info(resName,id,isLoop,volume)
this.effectDic.set(resName,info)
}
}
}
private async loadResEffectByUrl(resName:string){
let effect=this.effectResDic.get(resName)
if(!effect){
effect=await this.loadResByUrl(resName) as cc.AudioClip;
effect&&this.effectResDic.set(resName,effect)
}
return effect
}
private loadResEffectClone(resName:string){
let effect=this.effectResDic.get(resName)
if(!effect){
effect=this.loadResClone(resName)
effect&&this.effectResDic.set(resName,effect)
}
return effect
}
private async loadEffectAsync(resName:string){
let effect=this.effectResDic.get(resName)
if(!effect){
effect=await this.loadResAsync(ResConst.AudioABName,resName)
effect&&this.effectResDic.set(resName,effect)
}
return effect
}
private async loadResAsync(abName:string,resName:string):Promise<cc.AudioClip>{
let asMgr=AppFacade.getMgr(AssetMgr)
return await asMgr.loadAssetAsync<cc.AudioClip>(abName,resName,cc.AudioClip)
}
private loadResClone(resName:string,instantiate:boolean=false){
let prefab=cc.find(ResConst.AudioABName+"/"+resName);
if (!prefab) {
console.error("loadViewClone prefab is null")
return
}
let clone = instantiate && cc.instantiate(prefab) || prefab
return clone.getComponent(cc.AudioSource).clip;
}
private async loadResByUrl(resName:string){
return new Promise((resolve,reject)=>{
if(!resName){
reject("文件名错误!");
}
cc.assetManager.loadRemote(resName, (err, audioClip) => {
resolve(audioClip);
});
});
}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "164a6421-a6f8-45ea-87cd-cccd702a1787",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import UIWindowView from "../BaseView/UIWindowView";
import { EventConst } from "../ConstDefine/EventConst";
import AppFacade from "../AppFacade";
import LoopMgr from "./LoopMgr";
import Manager from "./Manager";
import View from "../BaseView/View";
/*
管理窗口类型的view
*/
class ViewInfo{
public view:View
public timer:number=0
public isRecycle:boolean=false
}
export default class ViewMgr extends Manager{
static get TypeName(): string{return "ViewMgr"}
private intervalId:number=-1
private viewDic:Map<string,ViewInfo>
private allVies:Array<View>
async start(){
this.allVies=new Array()
this.viewDic=new Map()
cc.systemEvent.on(EventConst.CloseAllWindow,this.closeAllWindowView,this)
this.intervalId=AppFacade.getMgr(LoopMgr).setInterval(this.onInterVal.bind(this),1)
console.log("ViewMgr onStart")
}
public release(){
console.log("ViewMgr onRelease")
AppFacade.getMgr(LoopMgr).clearInterval(this.intervalId)
this.intervalId=-1
cc.systemEvent.off(EventConst.CloseAllWindow,this.closeAllWindowView,this)
this.releaseViews()
}
private onInterVal(){
for(let [name,info] of this.viewDic.entries()){
if(!info.isRecycle) continue
info.timer-=1
if(info.timer<=0){
let view=info?.view
if(view&&!view.IsOpen){
info.view=null
this.viewDic.delete(name)
view.release()
}
}
}
}
/**
@param 释放所有windows 释放
*/
public releaseViews():void{
for(let i=this.allVies.length-1;i>=0;--i){
let view=this.allVies[i] as View
view?.release()
}
this.allVies.length=0
UIWindowView.maskView?.release()
UIWindowView.maskView=null
}
private closeAllWindowView():void{
UIWindowView.maskView?.closeAll()
}
/**
* 界面是否开启
* @param viewNames TODO
*/
public isViewOpen(...viewNames:string[]):boolean{
if(!viewNames) return false
let res=false
for(let name of viewNames){
let view=this.allVies?.find((view)=>view.getTypeName()==name)
if(view instanceof UIWindowView){
res=UIWindowView?.maskView.isInStack(view)
}else if(view instanceof View){
res=view.IsOpen
}
if(!res) break
}
return res
}
public openView<T extends View>(viewName:string,type:typeof View):T{
let info=this.viewDic.get(viewName)
if(!info){
info=new ViewInfo()
}
let view=info?.view
if(!view){
view=new type()
info.view=view
this.viewDic.set(viewName,info)
}
info.isRecycle=false
return <T>view
}
public async updateView(viewName:string,data?:Object){
let info=this.viewDic.get(viewName)
await info?.view?.updateData(data)
}
public async closeView(viewName:string){
let info=this.viewDic.get(viewName)
info?.view?.close()
}
public releaseView(viewName:string,releaseTime:number){
let info=this.viewDic.get(viewName)
if(!info) return
info.isRecycle=true
info.timer=releaseTime
}
public getView<T extends View>(viewName:string):T{
let info=this.viewDic.get(viewName)
return info?.view as T
}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "e468010d-20eb-415a-8658-5eaaf667af78",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import IModel from "./Interface/IModel";
import IController from "./Interface/IController";
//model用于存放模块数据
export default abstract class Model implements IModel{
constructor(protected control:IController){}
abstract init()
abstract release()
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "2090ba29-8cec-41fa-88f2-c28b671f8fe7",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "32033f68-fd6e-4d4f-a042-04d9e37c0624",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
import View from "../BaseView/View";
export default class UI extends View{
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "f507b183-fc83-448c-b9f8-d0d24b5b8236",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import AppFacade from "../AppFacade"
import SoundMgr from "../Manager/SoundMgr"
import GameUtil from "../Util/GameUtil"
import UIUtil from "../Util/UIUtil"
import UI from "./UI"
import { UIAnimation, UIAnimationParams } from "./UIConst"
export enum UIButtonType {
None = 0, //普通类型
SwitchImg, //点击切换图片,从Img0-ImgN
}
//构造的参数
class UIButtonConParams {
type?: UIButtonType=UIButtonType.None //按钮功能类型
maxImgNum?: number //切换图片的最大数量
btnName?: string //按钮名字
clickSound?: string //点击按钮音效
redKey?: string //红点
}
export default class UIButton extends UI {
private btn: cc.Button
private onClickCb: Function
private imgs: Array<cc.Sprite>
private imgIndex: number = 0
public set ImgIndex(val: number) {
if (this.imgIndex == val) return
this.imgIndex = val
this.swicthImg(this.imgIndex)
}
public params: UIButtonConParams
private redKey: string
private redTip: cc.Node
private label: cc.Label
private tween: cc.Tween
public constructor(params?: UIButtonConParams) {
super()
this.params=params??new UIButtonConParams()
}
protected async getChilds() {
this.btn = this.getChildComp("", cc.Button)
this.btn.node.on("click", this.onClick, this)
if (this.params.btnName) {
this.updateBtnName(this.params.btnName)
}
if (this.params.type == UIButtonType.SwitchImg) {
this.imgs = new Array()
if (!this.params.maxImgNum) console.error(this.node.name + "没有设置maxImgNum")
for (let i = 0; i < this.params.maxImgNum; ++i) {
let img = this.getChildComp("Img" + i, cc.Sprite)
if (img) {
this.imgs.push(img)
img.node.active = i == this.imgIndex
}
}
}
this.updateRedTip(this.params?.redKey)
if(this.params.type==UIButtonType.SwitchImg){
this.swicthImg(this.imgIndex)
}
}
protected async onUpdateData(data?: UIButtonConParams) {
let redKey = data?.redKey || ""
this.updateRedTip(redKey)
}
private updateRedTip(redKey: string) {
if (GameUtil.isStringEmpty(redKey) || this.redKey == redKey) return
this.redKey = redKey
if (!this.redTip) {
this.redTip = this.getChildNode("RedTip")
}
// this.redTip && RedPointController.Inst.model.registerRedPoint(redKey, this.redTip)
}
public addClickCb(cb: Function) {
this.onClickCb = cb
}
protected onClick() {
this.swicthImg(this.imgIndex + 1)
let clickSound = this.params?.clickSound
AppFacade.getMgr(SoundMgr).playEffect(clickSound)
this.onClickCb && this.onClickCb()
}
private swicthImg(index: number) {
if(!this.isLoadFinish) return
if (this.params.type != UIButtonType.SwitchImg || index < 0) return
let preIndex = this.imgIndex
this.imgIndex = index % this.params.maxImgNum
let preImg = this.imgs[preIndex]
preImg && (preImg.node.active = false)
let curImg = this.imgs[this.imgIndex]
curImg && (curImg.node.active = true)
}
//沉默是不能点击 半透明
public setSlience(isSlience: boolean) {
UIUtil.setSlience(this.btn, isSlience)
UIUtil.setSlience(this.label?.node, isSlience)
}
public setActive(isActive: boolean) {
if (!this.isRootView()) return
GameUtil.setActive(this.node, isActive)
GameUtil.setActive(this.label?.node,isActive)
this.btn.interactable = isActive
}
/**
* 隐藏是通过修改透明度0
*/
public setActive1(isActive: boolean) {
if (!this.isRootView()) return
GameUtil.setActive1(this.btn.node,isActive)
GameUtil.setActive1(this.label?.node,isActive)
}
public setInteraction(use: boolean) {
this.btn.interactable = use
}
/**
* 设置过名字后才有label组件
*/
public updateBtnName(name: string) {
if (!this.label) {
this.label = this.getChildComp("Background/Label", cc.Label)
}
this.label.string = name
}
public setLabelPos(pos:cc.Vec3){
if(!this.label){
this.label = this.getChildComp("Background/Label", cc.Label)
}
if(!this.label?.isValid) return
let curParent=this.label.node.parent
//优化了
if(curParent!=this.node){
let wPos=this.node.convertToWorldSpaceAR(pos)
pos=curParent.convertToNodeSpaceAR(wPos)
}
this.label.node.setPosition(pos)
}
public playAnimation(isPlay:boolean,params?:UIAnimationParams){
let type=params?.type
if(!isPlay){
if(type==UIAnimation.Scale){
this.node.scale=1
}else if(type==UIAnimation.Circle){
this.node.angle=0
}
this.tween?.stop()
}else{
let time=params?.time??0.3
if(type==UIAnimation.Scale){
this.tween = cc.tween(this.node).to(time, { scale: 1 }).to(time, { scale: 1.05 })
this.tween = this.tween.repeatForever(this.tween)
}else if(type==UIAnimation.Circle){
this.tween = cc.tween(this.node).by(time, { angle: 360 })
this.tween = this.tween.repeatForever(this.tween)
}
this.tween?.start()
}
}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "8a813e48-2e16-46a8-80b6-5252ea6ffe4d",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
export class UIAnimationParams{
type:UIAnimation=UIAnimation.None
time:number=0.3
}
//UI动画
export enum UIAnimation{
None,
Circle, //转圈
Scale, //缩放
}
{
"ver": "1.0.8",
"uuid": "0bc440f3-16d1-4ae4-825e-aba660fccdc6",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import UIRenderView from "./UIRenderView";
import UI from "./UI";
/**
* @param UI容器 有子对象的界面
*/
export default class UIContainer extends UI{
protected data:Array<Object>
protected renders: Array<UIRenderView>=new Array()
protected sendDataFromRenderCb:Function
protected isCommonData:boolean=false //相同的数据更新,只能判断引用
public async updateData(data?:Array<Object>){
this.isCommonData=this.data==data&&this.data!=undefined
this.data=data?.slice()||this.data||new Array()
await this.onUpdateData(this.data)
}
public release(){
this.renders?.forEach((r)=>r.release())
super.release()
}
//render回调回来
public addSendDataFromRender(cb:Function){
this.sendDataFromRenderCb=cb
}
//render回调数据
protected onSendDataFromRender(data?:Object){
this.sendDataFromRenderCb&&this.sendDataFromRenderCb(data)
}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "6d1a9710-6292-4eab-a565-383fd229b0b3",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "ccb1192c-9514-4eda-ac17-b9dac1e561b9",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
import MathUtil from "./MathUtil"
export default class GameUtil {
private static globalIndex: number = 0
public static get GIndex() { return this.globalIndex++ }
//全局游戏的安全距离
public static SAFE_OFFSET=cc.v2(40,40)
public static createNode(nodeName: string, parent: cc.Node = null) {
let node = new cc.Node(nodeName)
if (parent) {
node.parent = parent
}
else {
cc.director.getScene().addChild(node)
}
return node
}
public static createComp<T extends cc.Component>(nodeName: string, parent: cc.Node = null, component: typeof cc.Component): T {
let node = this.createNode(nodeName, parent)
let comp = node.addComponent(component)
return <T>comp
}
public static addComp<T extends cc.Component>(root: cc.Node, component: typeof cc.Component): T {
let res = root.getComponent(component)
if (!res) {
res = root.addComponent(component)
}
return <T>res
}
//判断相交
public static intersects(l:cc.Rect,r:cc.Rect):boolean{
if(l.size.height<=0||l.size.width<=0||r.size.height<=0||r.size.width<=0) return false
return l.intersects(r)
}
public static binarySearch(arr:number[],key:number):number{
let lo=0,hi=arr.length-1
while(lo<=hi){
let mid=Math.floor(lo+(hi-lo)/2)
if(arr[mid]>key){
hi=mid-1
}else if(arr[mid]<key){
lo=mid+1
}else{
return mid
}
}
return lo
}
/**
* 将坐标限制在屏幕的安全范围内
* 坐标轴是中心点是0,0
* 修改pos本身
* @param offset 向屏幕中间缩小offset距离
* @param range 正真的屏幕范围是cc.winSzie
*/
private static _viewRange
public static screenSafeRange(pos:cc.Vec3,offset:cc.Vec2=this.SAFE_OFFSET,range:cc.Size=null):cc.Vec3{
if(!GameUtil._viewRange){
GameUtil._viewRange=cc.view.getDesignResolutionSize()
}
if(!range){
range=GameUtil._viewRange
}
let halfH=range.height/2
let halfW=range.width/2
pos.x=Math.min(halfW-offset.x,pos.x)
pos.x=Math.max(-halfW+offset.x,pos.x)
pos.y=Math.min(halfH-offset.y,pos.y)
pos.y=Math.max(-halfH+offset.y,pos.y)
return pos
}
/** 获取屏幕中的安全点 */
public static getScreenSafePosRnd(offset:cc.Vec2=this.SAFE_OFFSET):cc.Vec3{
let size=cc.winSize
let height=size.height/2-offset.y
let width=size.width/2-offset.x
let x=MathUtil.randIntRange(-width,width)
let y=MathUtil.randIntRange(-height,height)
let res=cc.v3(x,y)
return res
}
public static setActive1(node:cc.Node,active:boolean){
if(!node) return
if(active){
node.opacity=255
}else{
node.opacity=0
}
}
public static setActive(node:cc.Node,active:boolean){
if(!cc.isValid(node)) return
node.active=active
}
/**
* @param 计算对象数量
*/
public static countObjNum(obj: Object): number {
let n = 0
for (let v in obj) { n++ }
return n
}
public static contactStrLine(...strs: string[]): string {
let res = ""
for (let s of strs) {
res.concat(s, "\r\n")
}
return res
}
//obj是否为空
public static isEmptyObj(obj:Object):boolean{
if(!obj) return true
if(typeof obj == "object"){
return JSON.stringify(obj)=="{}"
}
return false
}
/**
* 分割ab名和资源名
*/
public static splitResParams(str:string):{abName:string,resName:string}{
let res=null
if(str){
let splits=str.split('|')
if(splits&&splits.length>1){
res={abName:splits[0],resName:splits[1]}
}else{
res={abName:splits[0],resName:""}
}
}
return res
}
/**
* 分割事件的参数
* |线分割参数
* ,号分割数组
* {}包裹对象
*/
public static splitEventParams(str:string):{event:string,params:any[]}{
let splits=str.split('|')
if(splits.length>=1){
let res=null
res={event:splits[0],params:null}
if(splits.length>1){
let p=new Array()
for(let i=1;i<splits.length;++i){
this._parseParam(splits[i],p)
}
res.params=p
}
return res
}else{
return {event:str,params:undefined}
}
}
/**
* 组合出新的事件
*/
public static combinationEventParams(...vals:any[]):string{
let res=""
for(let val of vals){
if(typeof val == "object"){
res+=(JSON.stringify(val)+"|")
}else if(val instanceof Array){
let arr=""
for(let v of val){
arr+=(v+",")
}
res+=(arr+"|")
}
else{
res+=(val+"|")
}
}
return res
}
/**
* ,分割出来的是数组,如果事件需要参数是数组,就需要加,在后面
*/
private static _parseParam(param:string,res:Array<any>){
if(param.search(',')>=0){
let sp=param.split(',')
let arr=new Array()
for(let s of sp){
this._parseParam(s,arr)
}
res.push(arr)
}else if(param.search('{')>=0){
let json=JSON.parse(param)
res.push(json)
return
}
//简单类型
else{
let p=Number.parseFloat(param)
if(!isNaN(p)){
res.push(p)
return
}
//string
res.push(param)
return
}
}
public static isStringEmpty(str:string):boolean{
return !str||str==""
}
/** 小游戏平台 */
public static isSmallGame():boolean{
return !cc.sys.isNative&&cc.sys.isMobile
}
public static createTypeFromObj<T>(json:Object,type:{new():T}):T{
let res=new type()
if(json){
res=Object.assign(res,json)
}
return res
}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "0b0c53d9-36ad-431b-ad28-7eba0c016202",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
const charLimit=1000
const MONEY_SUFFIX=["k","m","b","t","aa","bb","cc","dd","ee","ff","gg","hh","ii","jj","kk","ll","mm","nn","oo","pp","qq","rr","ss","tt","uu","vv","ww","xx","yy","zz"]
const NumStrs = ['0','1','2','3','4','5','6','7','8','9']
export enum SortType{
Asc=0,
Desc=1,
}
export default class MathUtil {
//i=mv 冲量
//使用冲量表示,无论质量多少(质量大就乘以大小就乘上小的),都一定要达到速度vel
public static impulseSelf(vel:cc.Vec2,mass:number){
return vel.mulSelf(mass)
}
/**
* @param 0-0.999999
*/
private static rnd(seed) {
seed = (seed * 9301 + 49297) % 233280
return seed / (233280.0)
}
/**
* @param 随机数,线性同余,比Math.random靠谱,它概率都不一样
* 半开半闭区间[)
*/
public static randInt(n: number): number {
let today = new Date()
let seed = today.getTime()
seed = Math.random() * seed
let rnd = this.rnd(seed)
let res = Math.floor(rnd * n)
return res
}
/**生成bit位随机数*/
public static numArrRnd(bit:number=16):string{
let str=""
for (let i=0; i<bit;i++) {
const pos = Math.round(Math.random() * (NumStrs.length-1))
str += NumStrs [pos]
}
return str
}
/**
* @param 返回[0,1)之间的值
*/
public static rand(): number {
let today = new Date()
let seed = today.getTime() //用时间同一帧调用的值一样
seed = Math.random() * seed
let res = this.rnd(seed)
return res
}
public static randRange(left:number,right:number):number{
let min=Math.min(left,right)
let max=Math.max(left,right)
return MathUtil.rand()*(max-min)+min
}
/**
* @param [left,right)
*/
public static randIntRange(left: number, right: number): number {
if(left==right) return left
if (left < 0) {
let nl = this.randInt(left)
let nr = this.randInt(right)
if (this.randInt(2) == 1) {
return nl
} else {
return nr
}
} else {
let n = this.randInt(right) //[0,right) 25
let res = Math.floor(left + (right - 1 - left) / (right - 1) * n)
return res
}
}
//洗牌算法
public static shuffleSelf(input:Array<any>) {
const length = input?.length??0
if(length<=1) return input
let index:number=0
// 执行length-1次即可,i=0时替换的是自身,这么做没有意义
for (let i = length - 1; i; i --){
// 选取0到i-1中的一个位置
index = Math.floor(this.rand() * i)
// 与i位置的值互换
input[i] = input.splice(index, 1, input[i])[0]
}
return input
}
//洗牌算法[耗时比较长]
// public static shuffle1(arr:Array<any>){
// return arr&&arr.sort((a,b)=>this.rand()-0.5)
// }
/**
*
* @param arr 待排序数组
* @param type 升序还是降序
* @param funsKey 用来排序的返回number的函数名字
* @returns
*/
public static sort(arr:Array<any>,type:SortType,...funsKey:string[]){
return arr.sort((a,b)=>{
for(let i=0;i<funsKey.length;++i){
let funKey=funsKey[i]
let resA=a[funKey]()
let resB=b[funKey]()
if(resA==resB){
if(i<funsKey.length-1){
continue
}else{
return 0
}
}else{
if(type==SortType.Asc){
return resA-resB
}else{
return resB-resA
}
}
}
})
}
/**
* 计算两个向量的夹角,返回0-360
*
* dot = x1*x2 + y1*y2 # dot product
det = x1*y2 - y1*x2 # determinant 行列式
angle = atan2(det, dot) # atan2(y, x) or atan2(sin, cos)
* @param v1
* @param v2
*
* 以0,-1向量为起点,顺时针0-360
*/
public static countAngleV2(v1:cc.Vec2,v2:cc.Vec2):number{
let dot=v2.dot(v1)
let det=v2.x*v1.y-v2.y*v1.x
let angle=180*Math.atan2(det,dot)/Math.PI
if(angle<0){
angle+=360
}
return angle
}
/**
* 计算向量的夹角
* 不管z坐标
*/
public static countAngleV3(v1:cc.Vec3,v2:cc.Vec3):number{
return this.countAngleV2(cc.v2(v1),cc.v2(v2))
}
/**
* @param 格式化数值
*/
public static numericalFormat(val: number): string {
let res="0",index=-1
if(val>=Number.MAX_VALUE) return "unlimit"
if(val<=9999) return val.toFixed(0)
if(val>charLimit){
while(val>charLimit){
val/=charLimit
++index
}
if(MONEY_SUFFIX[index]==undefined){
res="unlimit"
}else{
res=val.toFixed(0)+MONEY_SUFFIX[index]
}
}else{
res=val.toFixed(0)
}
return res
}
//三个数选中间数
public static between(a, b, c):number {
return [a, b, c].sort((a, b) => {
return a - b;
})[1];
}
//两点间距离
public static distance(x1, y1, x2, y2) {
let dx = x1 - x2;
let dy = y1 - y2;
return Math.sqrt(dx * dx + dy * dy);
}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "d85e826c-3025-469a-a152-f7efbf9b5139",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import { ResConst } from "../ConstDefine/ResConst"
import AppFacade from "../AppFacade"
import AssetMgr from "../Manager/AssetMgr"
import View from "../BaseView/View"
import GameUtil from "./GameUtil"
export default class UIUtil {
public static optimizeViewNodes(view:View,nodes:string[],parent:cc.Node){
if(!nodes||nodes.length<=0) return
for (let i = 0; i < nodes.length; ++i) {
let param = view[nodes[i]]
let node = null
if (param instanceof cc.Node) {
node = param
} else if (param instanceof cc.Component) {
node = param.node
}
UIUtil.changeParentLast(node, view.node, parent)
}
}
public static optimizeViewLabels(views:View[],propertys:string[],modes:cc.Label.CacheMode[],parent:cc.Node){
for(let i=0;i<propertys.length;++i){
views.forEach((view)=>{
let label:cc.Label|cc.RichText=view[propertys[i]]
if(label){
this.changeParentLast(label.node,view.node,parent)
label.cacheMode=modes[i]||cc.Label.CacheMode.NONE
}
})
}
}
/**
* 1.将组件中的label移动到底部,进而优化合批
* 2.模式
* 1.如果内容不长改变,修改成bit
* 2.只有数字的常变内容,例如钱数额 修改成char
* 2.【注意】移动后active等按钮状态影响不了label要
*/
public static optimizeViewsLabel(views:View[],labelPropertyName:string,parent:cc.Node,mode:cc.Label.CacheMode){
if(!views||views.length<=0) return
for(let view of views){
let label:cc.Label|cc.RichText=view[labelPropertyName]
label.cacheMode=mode
let pos=label.node.parent.convertToWorldSpaceAR(label.node.position)
label.node.parent=parent
label.node.position=parent.convertToNodeSpaceAR(pos)
label.node.setSiblingIndex(parent.childrenCount)
}
}
public static optimizeToggleLabel(toggles:cc.Toggle[],parent:cc.Node,mode:cc.Label.CacheMode){
let labels:Array<cc.Label>=new Array()
for(let t of toggles){
labels.push(t.getComponentInChildren(cc.Label))
}
labels.forEach((label,i)=>{
label.cacheMode=mode
let pos=label.node.parent.convertToWorldSpaceAR(label.node.position)
label.node.parent=parent
label.node.position=parent.convertToNodeSpaceAR(pos)
label.node.setSiblingIndex(parent.childrenCount)
})
}
//设置按钮为沉默状态
public static setSlience(node:cc.Node,isSlience:boolean)
public static setSlience(btn: cc.Button, isSlience: boolean)
public static setSlience(val:any,isSlience: boolean) {
if (!val) return
if(val instanceof cc.Button){
val.node.opacity = isSlience && 128 || 255
val.interactable = !isSlience
}else if(val instanceof cc.Node){
val.opacity = isSlience && 128 || 255
}
}
public static setGray(node: cc.Node, isGray: boolean) {
if (node) {
let sprites = node.getComponentsInChildren(cc.RenderComponent)
let mat = isGray && cc.Material.getBuiltinMaterial("2d-gray-sprite") || cc.Material.getBuiltinMaterial("2d-sprite")
for (let s of sprites) {
s.setMaterial(0, mat)
}
}
}
/**
* @param 自适应界面应该有的工具
*/
public static autoFitCanvas(root: cc.Node,bangTopOffset:number=0,isOnce:boolean=false): cc.Widget {
let res = GameUtil.addComp<cc.Widget>(root, cc.Widget)
root.setContentSize(cc.view.getDesignResolutionSize())
res.isAlignBottom = true
res.isAlignTop = true
res.isAlignLeft = true
res.isAlignRight = true
res.top += bangTopOffset
res.updateAlignment()
return res
}
public static autoFitLeft(root:cc.Node,isOnce:boolean=false):cc.Widget{
let res = GameUtil.addComp<cc.Widget>(root, cc.Widget)
root.setContentSize(cc.view.getDesignResolutionSize())
res.isAlignLeft = true
isOnce&&(res.alignMode=cc.Widget.AlignMode.ONCE)
res.updateAlignment()
return res
}
public static autoFitRight(root:cc.Node,isOnce:boolean=false):cc.Widget{
let res = GameUtil.addComp<cc.Widget>(root, cc.Widget)
root.setContentSize(cc.view.getDesignResolutionSize())
res.isAlignRight = true
isOnce&&(res.alignMode=cc.Widget.AlignMode.ONCE)
res.updateAlignment()
return res
}
public static autoFitTop(root:cc.Node,isOnce:boolean=false):cc.Widget{
let res = GameUtil.addComp<cc.Widget>(root, cc.Widget)
root.setContentSize(cc.view.getDesignResolutionSize())
res.isAlignTop = true
isOnce&&(res.alignMode=cc.Widget.AlignMode.ONCE)
res.updateAlignment()
return res
}
public static autoFitBottom(root:cc.Node,isOnce:boolean=false):cc.Widget{
let res = GameUtil.addComp<cc.Widget>(root, cc.Widget)
root.setContentSize(cc.view.getDesignResolutionSize())
res.isAlignBottom = true
isOnce&&(res.alignMode=cc.Widget.AlignMode.ONCE)
res.updateAlignment()
return res
}
//强制更新Label
public static forceUpdatLabel(label:cc.Label){
label&&label["_forceUpdateRenderData"](true)
return label
}
/**
* @param node
* @param newParent
* @returns oldParent
*/
public static changeParent(node:cc.Node,newParent:cc.Node):cc.Node{
if(!node||!cc.isValid(node)||!newParent||!cc.isValid(newParent)||node==newParent) return
let oldParent=node.parent
let pos=oldParent.convertToWorldSpaceAR(node.position)
node.setParent(newParent)
node.position=newParent.convertToNodeSpaceAR(pos)
return oldParent
}
public static changeParentLast(node:cc.Node,preParent:cc.Node,parent:cc.Node){
//还是不应该修改active
// node.active=node.active&&preParent.activeInHierarchy
let pos=node.parent.convertToWorldSpaceAR(node.position)
node.parent=parent
node.position=parent.convertToNodeSpaceAR(pos)
node.setSiblingIndex(parent.childrenCount)
}
//从图集中提取精灵
private static _altasWeek:WeakMap<object,cc.SpriteAtlas>=new WeakMap()
public static async getSpriteAtlas(key:{abName:string,resName:string}):Promise<cc.SpriteFrame>{
let altas=this._altasWeek.get(key)
if(!altas||!cc.isValid(altas)){
altas=await AppFacade.getMgr(AssetMgr).loadAssetAsync<cc.SpriteAtlas>(ResConst.emptyABName,key.abName,cc.SpriteAtlas)
this._altasWeek.set(key,altas)
}
let sprite=altas?.getSpriteFrame(key.resName)
key=null
return sprite
}
//提取单图精灵
public static async getSprite(key:{abName:string,resName:string}):Promise<cc.SpriteFrame>{
let sprite:cc.SpriteFrame=await AppFacade.getMgr(AssetMgr).loadAssetAsync<cc.SpriteFrame>(key.abName,key.resName,cc.SpriteFrame)
return sprite
}
//提取网络图片
public static async getSpriteByUrl(key:{url:string}):Promise<cc.SpriteFrame>{
return new Promise((resolve, reject) => {
cc.loader.load(key, (err, img) => {
if (err) {
cc.error("loadBundleByUrl error", key.url, err)
reject(err)
}
else {
const spriteFrame = new cc.SpriteFrame(img)
resolve(spriteFrame);
}
})
});
}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "0ffe6c19-3370-4746-a5c3-40274afb5ba2",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "e255299c-d3b7-4835-b16f-899e79923fde",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
import View from "../BaseView/View";
export default class ViewComp extends View{
public constructor(protected view:View){
super()
}
protected emitEvent(){}
public open(){}
public close(){}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "fd985f5b-66c5-4e28-bb37-d3fb96d046f3",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "b979a955-1ecb-4c01-9ce6-f3fbdedf3cc1",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
import AppFacade from "../Core/AppFacade";
import { ResConst } from "../Core/ConstDefine/ResConst";
import { ViewConst } from "../Core/ConstDefine/ViewConst";
import Controller from "../Core/Controller";
import SoundMgr from "../Core/Manager/SoundMgr";
import GameUtil from "../Core/Util/GameUtil";
import MenuModel from "./MenuModel";
import MenuView from "./MenuView";
export default class MenuController extends Controller{
private view:MenuView
private model:MenuModel
private catAni:dragonBones.ArmatureDisplay
private stageIdx:number=0
private colorCur:string //当前选择的色彩
private answers:number[]
private camera:cc.Camera
private isCanTap:boolean=true;
constructor(){
super();
}
public static get Inst(): MenuController {
if (this._inst == null) {
this._inst = new MenuController()
}
return this._inst
}
public async init(): Promise<void> {
cc.macro.CLEANUP_IMAGE_CACHE = false;
this.model=new MenuModel(this);
await this.model.init();
this.view=await this.getView(ViewConst.MenuView,MenuView) as MenuView;
await this.view.updateData(this.model);
this.view.open();
// let gameData=this.model.getItem(this.stageIdx);
// let words=gameData.words.split("");
// let answers=gameData.answers.split("");
// let itemAudio=gameData.audio_url;
this.answers=new Array();
// cc.log(words);
// cc.log(answers);
let colorBlocks=this.view.colorItems1;
for(let i=0;i<colorBlocks.length;i++){
cc.log(colorBlocks[i].name);
// let word=colorBlocks[i].getComponentInChildren(cc.Label);
// word.string=words[i];
colorBlocks[i].color=cc.Color.WHITE;
// colorBlocks[i].getComponent(cc.Sprite).trim=true;
colorBlocks[i].on(cc.Node.EventType.TOUCH_START,()=>{
// if(!this.isCanTap){
// return;
// }
// this.isCanTap=false;
if(GameUtil.isEmptyObj(this.colorCur))
{
return;
}
this.answers[i]=i;
let color=new cc.Color();
color.fromHEX(this.colorCur);
colorBlocks[i].color=color;
// cc.Color.fromHEX(colorBlocks[i].color,+"#"+this.colorCur);
this.onRight();
let flag=0;
for(let i=0;i<this.answers.length;i++){
if(this.answers[i]==i){
flag++;
}
}
(flag>=colorBlocks.length)&&this.finish();
// // this.onClickBlock(i,answers);
// let result=answers.findIndex((item)=>{
// return item==i.toString();
// });
// cc.log("i:"+i+",result:"+result)
// if(result==-1){
// this.onWrong();
// }
// else{
// this.answers[result]=i.toString();
// let color=new cc.Color();
// color.fromHEX(this.colorCur);
// colorBlocks[i].color=color;
// // cc.Color.fromHEX(colorBlocks[i].color,+"#"+this.colorCur);
// this.onRight();
// let flag=0;
// for(let i=0;i<this.answers.length;i++){
// if(this.answers[i]==answers[i]){
// flag++;
// }
// }
// (flag>=answers.length)&&this.finish();
// }
});
colorBlocks[i]._hitTest=this._hitTest.bind(this);
}
this.catAni=this.view.roleAnimation;
let btnColors=this.view.btnColors
for(let i=0;i<btnColors.length;i++){
btnColors[i].addClickCb(()=>{
this.onClickColor(btnColors[i].node)
});
}
this.view.btnRole.addClickCb(this.onClickRole.bind(this));
this.enter();
}
private onClickBlock(idx:number,answers:string[]){
}
private onClickColor(node:cc.Node){
if(!this.isCanTap){
return;
}
let choice=this.view.choiceColor;
choice.active=true;
choice.x=node.x;
choice.y=node.y;
let color=node.name;
cc.log(color);
AppFacade.getMgr(SoundMgr).playResEffect(ResConst.snd.click);
this.colorCur=color;
}
private enter(){
// let gameData=this.model.getItem(this.stageIdx);
// let itemAudio=gameData.audio_url;
// AppFacade.getMgr(SoundMgr).playEffectByUrl(itemAudio);
AppFacade.getMgr(SoundMgr).playEffectByUrl(this.model.getStartAudio());
this.playDragonBoneAnimation(this.catAni,"begin",1,()=>{
this.playDragonBoneAnimation(this.catAni,"normal",-1);
});
}
private wait(){
AppFacade.getMgr(SoundMgr).playEffectByUrl(this.model.getWaitAudio());
this.playDragonBoneAnimation(this.catAni,"normal",-1);
}
private finish(){
AppFacade.getMgr(SoundMgr).playEffectByUrl(this.model.getFinishAudio());
this.playDragonBoneAnimation(this.catAni,"finish",1,()=>{
this.playDragonBoneAnimation(this.catAni,"normal",-1);
});
this.isCanTap=false;
// this.view.resultPaint.active=true;
// this.view.paint.active=false;
// let resultPaint=this.view.resultPaint.children[0];
this.view.showPaint2();
let colorBlocks=this.view.colorItems1;
let colorBlocks2=this.view.colorItems2;
// let colorBlocks=this.view.colorItems;
for(let i=0;i<colorBlocks.length;i++){
// cc.log(colorBlocks[i].color);
let word=colorBlocks[i].getComponentInChildren(cc.Label);
// word.string=words[i];
// colorBlocks[i].color=cc.Color.WHITE;
let item=colorBlocks2[i]
if(colorBlocks[i].color){
item.color=colorBlocks[i].color;
}
else
{
item.color=cc.Color.WHITE
}
// let w=item.getComponentInChildren(cc.Label);
// w.string=word.string;
// w.node.color=cc.Color.BLACK;
}
}
private finishWait(){
AppFacade.getMgr(SoundMgr).playEffectByUrl(this.model.getFinishWaitAudio());
this.playDragonBoneAnimation(this.catAni,"normal",-1);
}
private onPaint(){
AppFacade.getMgr(SoundMgr).playResEffect(ResConst.snd.painted);
}
private async onRight(){
AppFacade.getMgr(SoundMgr).playResEffect(ResConst.snd.right);
this.playDragonBoneAnimation(this.catAni,"right",1,()=>{
this.playDragonBoneAnimation(this.catAni,"normal",-1);
});
cc.log("Right")
}
private onWrong(){
AppFacade.getMgr(SoundMgr).playResEffect(ResConst.snd.wrong);
this.playDragonBoneAnimation(this.catAni,"wrong",1,()=>{
this.playDragonBoneAnimation(this.catAni,"normal",-1);
});
cc.log("Wrong")
}
private onClickRole(){
// AppFacade.getMgr(SoundMgr).playResEffect(ResConst.snd.click);
AppFacade.getMgr(SoundMgr).playEffectByUrl(this.model.getStartAudio());
}
public release(): void {
}
private playDragonBoneAnimation(node, animationName, time = 1, onFinish = null, onFrameEvent = null) {
const armatureDisplay = node.getComponent(dragonBones.ArmatureDisplay);
armatureDisplay.once(dragonBones.EventObject.COMPLETE, () => {
if (onFinish) {
onFinish();
}
});
armatureDisplay.on(dragonBones.EventObject.FRAME_EVENT, (event) => {
if (onFrameEvent) {
onFrameEvent(event);
}
});
console.log('animationName = ' + animationName);
console.log('time = ' + time);
armatureDisplay.playAnimation(animationName, time);
return armatureDisplay;
}
_hitTest(location, listener) {
const sprite = listener.owner;
let spriteFrame = sprite.getComponent(cc.Sprite).spriteFrame;
if (spriteFrame == null) {
return false;
}
let posInNode = sprite.convertToNodeSpaceAR(location);
let rect = spriteFrame.getRect();
let offset = spriteFrame.getOffset();
if ((posInNode.x < offset.x - (rect.width * sprite.anchorX))
|| (posInNode.y < offset.y - (rect.height * sprite.anchorY))
|| (posInNode.x > (offset.x + (rect.width * (1 - sprite.anchorX))))
|| (posInNode.y > (offset.y + (rect.height * (1 - sprite.anchorY))))) {
return false;
}
if (!this.camera) {
const checkCameraNode = cc.find('Canvas/CheckCamera');
if (!checkCameraNode) {
throw '找不到[Canvas/CheckCamera]。';
}
this.camera = checkCameraNode.getComponent(cc.Camera);
}
if (this.camera.cullingMask != -2) {
console.warn(`[${this.camera.cullingMask}]: 检查CheckCamera的cullingMask值,应该只选择camera`);
}
this.camera.node.active = true;
let posInRect = cc.v2(
(posInNode.x - offset.x + rect.width * sprite.anchorX),
(posInNode.y - offset.y + rect.height * sprite.anchorY)
);
let tex = spriteFrame.getTexture();
this.camera.enabled = true;
let rt;
let destory = false;
if (tex instanceof cc.RenderTexture) {
rt = tex;
} else {
rt = new cc.RenderTexture()
rt.initWithSize(tex.width, tex.height, cc.gfx.RB_FMT_S8);
rt.drawTextureAt(tex, 0, 0);
destory = true;
}
// data就是这个texture的rgba值数组
this.camera.targetTexture = rt;
this.camera.render(undefined);
let data;
//图集里的图片可能会旋转
if (spriteFrame.isRotated()) {
data = rt.readPixels(null, rect.x + posInRect.y, rect.y + posInRect.x, 1, 1);
} else {
data = rt.readPixels(null, rect.x + posInRect.x, rect.y + rect.height - posInRect.y, 1, 1);
}
this.camera.targetTexture = null;
this.camera.enabled = false;
this.camera.node.active = false;
if (destory) {
rt.destroy();
}
if (data[3] > 0) {
return true;
} else {
return false;
}
}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "92c76300-d382-4162-a412-786aa7a8ef8d",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import Model from "../Core/Model";
import { defaultData } from "../defaultData";
export default class MenuModel extends Model{
public stageIdx=0;
private data;
public async init() {
let getData = this.getData.bind(this);
if (window && window.courseware) {
getData = window.courseware.getData;
}
await new Promise<void>(resolve=>{
getData((data) => {
resolve();
// cc.log('get data:' + data);
cc.log(data);
this.data = data || this.getDefaultData();
this.data = JSON.parse(JSON.stringify(this.data))
})
})
}
private getDefaultData() {
return defaultData;
}
private getData(func) {
if (window && window.courseware) {
window.courseware.getData(func, 'scene');
return;
}
const middleLayer = cc.find('middleLayer');
if (middleLayer) {
const middleLayerComponent = middleLayer.getComponent('middleLayer');
middleLayerComponent.getData(func);
return;
}
func(this.getDefaultData());
}
public getFont(){
let node=cc.find("res/font/MMTextBook-Bold");
let label=node.getComponent(cc.Label);
return label.font;
}
public getConfigs(){
return this.data;
}
// public getItems(){
// return this.data.items;
// }
// public getItem(idx:number){
// return this.data.items[idx];
// }
public getStartAudio(){
return this.data.startAudio;
}
public getWaitAudio(){
return this.data.waitAudio;
}
public getFinishAudio(){
return this.data.finishAudio;
}
public getFinishWaitAudio(){
return this.data.finishWaitAudio;
}
public getBG(){
return this.data.bg;
}
public getImages(){
return this.data.images;
}
public getImage(idx:number){
return this.data.images[idx];
}
release() {
}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "8ecc3d4f-28ac-494a-a657-388c4d54dba4",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import UIFullView from "../Core/BaseView/UIFullView";
import { ViewConst } from "../Core/ConstDefine/ViewConst";
import UIButton from "../Core/UI/UIButton";
import GameUtil from "../Core/Util/GameUtil";
import UIUtil from "../Core/Util/UIUtil";
import MenuModel from "./MenuModel";
export default class MenuView extends UIFullView{
private paint:cc.Node; //游戏画板
private resultPaint:cc.Node; //结束画板
public paint1:cc.Node; //游戏色块父节点
public paint2:cc.Node; //结束面板色块父节点
// public palette:cc.Node; //调色板
public choiceColor:cc.Node; //色彩选择框
public roleAnimation:dragonBones.ArmatureDisplay;//动画角色猫龙骨骼
public btnSubmit:UIButton //提交按钮*取消
public btnColors:UIButton[] //色彩按钮
public colorItems1:cc.Node[]; //要涂的色块对象。每个色块为一个节点。对节点进行改色
public colorItems2:cc.Node[]; //结束面板色块对象。每个色块为一个节点。对节点进行改色
public btnRole:UIButton
public getTypeName(): string {
return ViewConst.MenuView;
}
protected async getChilds(){
this.paint=this.getChildNode("main_area/paint");
this.paint1=this.getChildNode("main_area/paint/alligator");
this.paint1.destroyAllChildren();
// this.colorItems=new Array();
// for(let i=0;i<colorArea.childrenCount;i++){
// let item=colorArea.children[i];
// this.colorItems[i]=item;
// }
this.resultPaint=this.getChildNode("paint2");
this.paint2=this.getChildNode("paint2/alligator");
this.paint2.destroyAllChildren();
let palette=this.getChildNode("color_area");
this.choiceColor=this.getChildNode("color_area/icon_choose");
this.roleAnimation=this.getChildComp("bottom_area/coolcat",dragonBones.ArmatureDisplay);
this.btnRole=new UIButton();
this.btnRole.loadViewClone(this.getChildNode("bottom_area/BtnCoolCat"),false);
this.btnSubmit=new UIButton();
this.btnSubmit.loadViewClone(this.getChildNode("bottom_area/btn_submit"),false);
this.btnColors=new Array();
for(let i=0;i<palette.childrenCount;i++){
let btn_node=palette.children[i];
if(btn_node.active){
let btnColor=new UIButton();
btnColor.loadViewClone(btn_node,false);
this.btnColors.push(btnColor);
}
}
}
public showPaint2(){
this.paint.active=false;
this.resultPaint.active=true;
}
protected async onUpdateData(model:MenuModel){
let images:{img:string}[]=model.getImages();
let bg1=this.getChildComp("main_area/paint/bg_img",cc.Sprite);
let bg2=this.getChildComp("paint2/bg_img",cc.Sprite);
bg1.spriteFrame=await UIUtil.getSpriteByUrl(model.getBG());
bg2.spriteFrame=await UIUtil.getSpriteByUrl(model.getBG());
//要涂的色块
this.colorItems1 = new Array();
let colorArea1=this.paint1;
this.colorItems2 = new Array();
let colorArea2=this.paint2;
// let gameData=model.getItem(model.stageIdx);
// let words=gameData.words.split("");
// let pos=gameData.pos;
for (let i = 0; i < images.length; i++) {
let spriteFrame = await UIUtil.getSpriteByUrl({url:images[i].img})
let item1=GameUtil.createNode("img"+1,colorArea1);
item1.group="camera";
let sprite1:cc.Sprite=this.addCCComp(item1,cc.Sprite);
sprite1.spriteFrame=spriteFrame;
// let wordNode1=GameUtil.createNode("word",item1);
// wordNode1.x= pos[i][0];
// wordNode1.y=pos[i][1];
// wordNode1.color=cc.Color.BLACK;
// let label1:cc.Label=this.addCCComp(wordNode1,cc.Label);
// label1.string=words[i];
// label1.font=model.getFont();
// label1.fontSize=80;
// label1.lineHeight=80;
this.colorItems1[i] = sprite1.node;
let item2=GameUtil.createNode("img"+1,colorArea2);
item2.group="camera"
let sprite2:cc.Sprite=this.addCCComp(item2,cc.Sprite);
sprite2.spriteFrame=spriteFrame;
// let wordNode2=GameUtil.createNode("word",item2);
// wordNode2.x=pos[i][0];
// wordNode2.y=pos[i][1];
// wordNode2.color=cc.Color.BLACK;
// let label2:cc.Label=this.addCCComp(wordNode2,cc.Label);
// label2.string=words[i];
// label2.font=model.getFont();
// label2.fontSize=80;
// label2.lineHeight=80;
this.colorItems2[i] = sprite2.node;
}
}
protected onOpen(){
}
protected onClose(){
}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "a67b1f99-fd35-456e-8b20-95569f4115ed",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
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