Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
middleLayer_for_debug
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
template admin
middleLayer_for_debug
Commits
44973cb8
Commit
44973cb8
authored
Mar 10, 2022
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 适配ui尺寸
parent
963fe620
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
940 additions
and
897 deletions
+940
-897
middleLayer_for_debug.fire
...ts/middleLayer_for_debug/scene/middleLayer_for_debug.fire
+108
-139
middleLayer.js
assets/middleLayer_for_debug/script/middleLayer.js
+832
-758
No files found.
assets/middleLayer_for_debug/scene/middleLayer_for_debug.fire
View file @
44973cb8
...
@@ -295,25 +295,25 @@
...
@@ -295,25 +295,25 @@
"__id__": 20
"__id__": 20
},
},
{
{
"__id__": 13
8
"__id__": 13
7
},
},
{
{
"__id__": 17
3
"__id__": 17
2
},
},
{
{
"__id__": 17
7
"__id__": 17
6
},
},
{
{
"__id__": 17
9
"__id__": 17
8
}
}
],
],
"_active": true,
"_active": true,
"_components": [
"_components": [
{
{
"__id__": 1
90
"__id__": 1
89
},
},
{
{
"__id__": 19
1
"__id__": 19
0
}
}
],
],
"_prefab": null,
"_prefab": null,
...
@@ -1013,11 +1013,7 @@
...
@@ -1013,11 +1013,7 @@
}
}
],
],
"_active": true,
"_active": true,
"_components": [
"_components": [],
{
"__id__": 137
}
],
"_prefab": null,
"_prefab": null,
"_opacity": 255,
"_opacity": 255,
"_color": {
"_color": {
...
@@ -1029,8 +1025,8 @@
...
@@ -1029,8 +1025,8 @@
},
},
"_contentSize": {
"_contentSize": {
"__type__": "cc.Size",
"__type__": "cc.Size",
"width": 1
28
0,
"width": 1
12
0,
"height":
72
0
"height":
51
0
},
},
"_anchorPoint": {
"_anchorPoint": {
"__type__": "cc.Vec2",
"__type__": "cc.Vec2",
...
@@ -6784,33 +6780,6 @@
...
@@ -6784,33 +6780,6 @@
"_N$reverse": false,
"_N$reverse": false,
"_id": "bc3W7j5EVJRaoW20bSToA3"
"_id": "bc3W7j5EVJRaoW20bSToA3"
},
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 20
},
"_enabled": true,
"alignMode": 2,
"_target": null,
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 1280,
"_originalHeight": 720,
"_id": "c87OiuHMRI7YOL5SUoikbx"
},
{
{
"__type__": "cc.Node",
"__type__": "cc.Node",
"_name": "ConsoleNode",
"_name": "ConsoleNode",
...
@@ -6820,25 +6789,25 @@
...
@@ -6820,25 +6789,25 @@
},
},
"_children": [
"_children": [
{
{
"__id__": 13
9
"__id__": 13
8
},
},
{
{
"__id__": 14
5
"__id__": 14
4
},
},
{
{
"__id__": 14
8
"__id__": 14
7
},
},
{
{
"__id__": 15
6
"__id__": 15
5
},
},
{
{
"__id__": 16
4
"__id__": 16
3
}
}
],
],
"_active": true,
"_active": true,
"_components": [
"_components": [
{
{
"__id__": 17
2
"__id__": 17
1
}
}
],
],
"_prefab": null,
"_prefab": null,
...
@@ -6894,20 +6863,20 @@
...
@@ -6894,20 +6863,20 @@
"_name": "content",
"_name": "content",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 13
8
"__id__": 13
7
},
},
"_children": [
"_children": [
{
{
"__id__": 1
40
"__id__": 1
39
}
}
],
],
"_active": false,
"_active": false,
"_components": [
"_components": [
{
{
"__id__": 14
3
"__id__": 14
2
},
},
{
{
"__id__": 14
4
"__id__": 14
3
}
}
],
],
"_prefab": null,
"_prefab": null,
...
@@ -6963,16 +6932,16 @@
...
@@ -6963,16 +6932,16 @@
"_name": "label",
"_name": "label",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 13
9
"__id__": 13
8
},
},
"_children": [],
"_children": [],
"_active": true,
"_active": true,
"_components": [
"_components": [
{
{
"__id__": 14
1
"__id__": 14
0
},
},
{
{
"__id__": 14
2
"__id__": 14
1
}
}
],
],
"_prefab": null,
"_prefab": null,
...
@@ -7028,7 +6997,7 @@
...
@@ -7028,7 +6997,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 1
40
"__id__": 1
39
},
},
"_enabled": true,
"_enabled": true,
"_materials": [
"_materials": [
...
@@ -7061,7 +7030,7 @@
...
@@ -7061,7 +7030,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 1
40
"__id__": 1
39
},
},
"_enabled": true,
"_enabled": true,
"alignMode": 1,
"alignMode": 1,
...
@@ -7088,7 +7057,7 @@
...
@@ -7088,7 +7057,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 13
9
"__id__": 13
8
},
},
"_enabled": true,
"_enabled": true,
"_layoutSize": {
"_layoutSize": {
...
@@ -7120,7 +7089,7 @@
...
@@ -7120,7 +7089,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 13
9
"__id__": 13
8
},
},
"_enabled": true,
"_enabled": true,
"alignMode": 2,
"alignMode": 2,
...
@@ -7147,16 +7116,16 @@
...
@@ -7147,16 +7116,16 @@
"_name": "bg",
"_name": "bg",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 13
8
"__id__": 13
7
},
},
"_children": [],
"_children": [],
"_active": false,
"_active": false,
"_components": [
"_components": [
{
{
"__id__": 14
6
"__id__": 14
5
},
},
{
{
"__id__": 14
7
"__id__": 14
6
}
}
],
],
"_prefab": null,
"_prefab": null,
...
@@ -7212,7 +7181,7 @@
...
@@ -7212,7 +7181,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 14
5
"__id__": 14
4
},
},
"_enabled": true,
"_enabled": true,
"_materials": [
"_materials": [
...
@@ -7244,7 +7213,7 @@
...
@@ -7244,7 +7213,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 14
5
"__id__": 14
4
},
},
"_enabled": true,
"_enabled": true,
"alignMode": 1,
"alignMode": 1,
...
@@ -7271,15 +7240,18 @@
...
@@ -7271,15 +7240,18 @@
"_name": "Console",
"_name": "Console",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 13
8
"__id__": 13
7
},
},
"_children": [
"_children": [
{
{
"__id__": 14
9
"__id__": 14
8
}
}
],
],
"_active": false,
"_active": false,
"_components": [
"_components": [
{
"__id__": 151
},
{
{
"__id__": 152
"__id__": 152
},
},
...
@@ -7288,9 +7260,6 @@
...
@@ -7288,9 +7260,6 @@
},
},
{
{
"__id__": 154
"__id__": 154
},
{
"__id__": 155
}
}
],
],
"_prefab": null,
"_prefab": null,
...
@@ -7346,16 +7315,16 @@
...
@@ -7346,16 +7315,16 @@
"_name": "content",
"_name": "content",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 14
8
"__id__": 14
7
},
},
"_children": [],
"_children": [],
"_active": true,
"_active": true,
"_components": [
"_components": [
{
{
"__id__": 1
50
"__id__": 1
49
},
},
{
{
"__id__": 15
1
"__id__": 15
0
}
}
],
],
"_prefab": null,
"_prefab": null,
...
@@ -7411,7 +7380,7 @@
...
@@ -7411,7 +7380,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 14
9
"__id__": 14
8
},
},
"_enabled": true,
"_enabled": true,
"_layoutSize": {
"_layoutSize": {
...
@@ -7443,7 +7412,7 @@
...
@@ -7443,7 +7412,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 14
9
"__id__": 14
8
},
},
"_enabled": true,
"_enabled": true,
"alignMode": 1,
"alignMode": 1,
...
@@ -7470,7 +7439,7 @@
...
@@ -7470,7 +7439,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 14
8
"__id__": 14
7
},
},
"_enabled": true,
"_enabled": true,
"alignMode": 2,
"alignMode": 2,
...
@@ -7497,7 +7466,7 @@
...
@@ -7497,7 +7466,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 14
8
"__id__": 14
7
},
},
"_enabled": true,
"_enabled": true,
"_materials": [
"_materials": [
...
@@ -7517,7 +7486,7 @@
...
@@ -7517,7 +7486,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 14
8
"__id__": 14
7
},
},
"_enabled": true,
"_enabled": true,
"horizontal": false,
"horizontal": false,
...
@@ -7529,10 +7498,10 @@
...
@@ -7529,10 +7498,10 @@
"scrollEvents": [],
"scrollEvents": [],
"cancelInnerEvents": true,
"cancelInnerEvents": true,
"_N$content": {
"_N$content": {
"__id__": 14
9
"__id__": 14
8
},
},
"content": {
"content": {
"__id__": 14
9
"__id__": 14
8
},
},
"_id": "43wBGhGBpFP7OYyNM+j0Ho"
"_id": "43wBGhGBpFP7OYyNM+j0Ho"
},
},
...
@@ -7541,7 +7510,7 @@
...
@@ -7541,7 +7510,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 14
8
"__id__": 14
7
},
},
"_enabled": true,
"_enabled": true,
"_layoutSize": {
"_layoutSize": {
...
@@ -7573,20 +7542,20 @@
...
@@ -7573,20 +7542,20 @@
"_name": "BtnClose",
"_name": "BtnClose",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 13
8
"__id__": 13
7
},
},
"_children": [
"_children": [
{
{
"__id__": 15
7
"__id__": 15
6
}
}
],
],
"_active": false,
"_active": false,
"_components": [
"_components": [
{
{
"__id__": 16
2
"__id__": 16
1
},
},
{
{
"__id__": 16
3
"__id__": 16
2
}
}
],
],
"_prefab": null,
"_prefab": null,
...
@@ -7642,20 +7611,20 @@
...
@@ -7642,20 +7611,20 @@
"_name": "Background",
"_name": "Background",
"_objFlags": 512,
"_objFlags": 512,
"_parent": {
"_parent": {
"__id__": 15
6
"__id__": 15
5
},
},
"_children": [
"_children": [
{
{
"__id__": 15
8
"__id__": 15
7
}
}
],
],
"_active": true,
"_active": true,
"_components": [
"_components": [
{
{
"__id__": 1
60
"__id__": 1
59
},
},
{
{
"__id__": 16
1
"__id__": 16
0
}
}
],
],
"_prefab": null,
"_prefab": null,
...
@@ -7711,13 +7680,13 @@
...
@@ -7711,13 +7680,13 @@
"_name": "Label",
"_name": "Label",
"_objFlags": 512,
"_objFlags": 512,
"_parent": {
"_parent": {
"__id__": 15
7
"__id__": 15
6
},
},
"_children": [],
"_children": [],
"_active": true,
"_active": true,
"_components": [
"_components": [
{
{
"__id__": 15
9
"__id__": 15
8
}
}
],
],
"_prefab": null,
"_prefab": null,
...
@@ -7773,7 +7742,7 @@
...
@@ -7773,7 +7742,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 15
8
"__id__": 15
7
},
},
"_enabled": true,
"_enabled": true,
"_materials": [
"_materials": [
...
@@ -7806,7 +7775,7 @@
...
@@ -7806,7 +7775,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 15
7
"__id__": 15
6
},
},
"_enabled": true,
"_enabled": true,
"_materials": [
"_materials": [
...
@@ -7838,7 +7807,7 @@
...
@@ -7838,7 +7807,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 15
7
"__id__": 15
6
},
},
"_enabled": true,
"_enabled": true,
"alignMode": 0,
"alignMode": 0,
...
@@ -7865,7 +7834,7 @@
...
@@ -7865,7 +7834,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 15
6
"__id__": 15
5
},
},
"_enabled": true,
"_enabled": true,
"_normalMaterial": null,
"_normalMaterial": null,
...
@@ -7938,7 +7907,7 @@
...
@@ -7938,7 +7907,7 @@
"__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
"__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
},
},
"_N$target": {
"_N$target": {
"__id__": 15
7
"__id__": 15
6
},
},
"_id": "54SC9WcmBAZ6cTznyI0o+3"
"_id": "54SC9WcmBAZ6cTznyI0o+3"
},
},
...
@@ -7947,7 +7916,7 @@
...
@@ -7947,7 +7916,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 15
6
"__id__": 15
5
},
},
"_enabled": true,
"_enabled": true,
"alignMode": 1,
"alignMode": 1,
...
@@ -7974,20 +7943,20 @@
...
@@ -7974,20 +7943,20 @@
"_name": "BtnOpen",
"_name": "BtnOpen",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 13
8
"__id__": 13
7
},
},
"_children": [
"_children": [
{
{
"__id__": 16
5
"__id__": 16
4
}
}
],
],
"_active": false,
"_active": false,
"_components": [
"_components": [
{
{
"__id__": 1
70
"__id__": 1
69
},
},
{
{
"__id__": 17
1
"__id__": 17
0
}
}
],
],
"_prefab": null,
"_prefab": null,
...
@@ -8043,20 +8012,20 @@
...
@@ -8043,20 +8012,20 @@
"_name": "Background",
"_name": "Background",
"_objFlags": 512,
"_objFlags": 512,
"_parent": {
"_parent": {
"__id__": 16
4
"__id__": 16
3
},
},
"_children": [
"_children": [
{
{
"__id__": 16
6
"__id__": 16
5
}
}
],
],
"_active": true,
"_active": true,
"_components": [
"_components": [
{
{
"__id__": 16
8
"__id__": 16
7
},
},
{
{
"__id__": 16
9
"__id__": 16
8
}
}
],
],
"_prefab": null,
"_prefab": null,
...
@@ -8112,13 +8081,13 @@
...
@@ -8112,13 +8081,13 @@
"_name": "Label",
"_name": "Label",
"_objFlags": 512,
"_objFlags": 512,
"_parent": {
"_parent": {
"__id__": 16
5
"__id__": 16
4
},
},
"_children": [],
"_children": [],
"_active": true,
"_active": true,
"_components": [
"_components": [
{
{
"__id__": 16
7
"__id__": 16
6
}
}
],
],
"_prefab": null,
"_prefab": null,
...
@@ -8174,7 +8143,7 @@
...
@@ -8174,7 +8143,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 16
6
"__id__": 16
5
},
},
"_enabled": true,
"_enabled": true,
"_materials": [
"_materials": [
...
@@ -8207,7 +8176,7 @@
...
@@ -8207,7 +8176,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 16
5
"__id__": 16
4
},
},
"_enabled": true,
"_enabled": true,
"_materials": [
"_materials": [
...
@@ -8239,7 +8208,7 @@
...
@@ -8239,7 +8208,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 16
5
"__id__": 16
4
},
},
"_enabled": true,
"_enabled": true,
"alignMode": 0,
"alignMode": 0,
...
@@ -8266,7 +8235,7 @@
...
@@ -8266,7 +8235,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 16
4
"__id__": 16
3
},
},
"_enabled": true,
"_enabled": true,
"_normalMaterial": null,
"_normalMaterial": null,
...
@@ -8339,7 +8308,7 @@
...
@@ -8339,7 +8308,7 @@
"__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
"__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
},
},
"_N$target": {
"_N$target": {
"__id__": 16
5
"__id__": 16
4
},
},
"_id": "81HoUuRyJOppi+n4Av/u0p"
"_id": "81HoUuRyJOppi+n4Av/u0p"
},
},
...
@@ -8348,7 +8317,7 @@
...
@@ -8348,7 +8317,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 16
4
"__id__": 16
3
},
},
"_enabled": true,
"_enabled": true,
"alignMode": 1,
"alignMode": 1,
...
@@ -8375,7 +8344,7 @@
...
@@ -8375,7 +8344,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 13
8
"__id__": 13
7
},
},
"_enabled": true,
"_enabled": true,
"alignMode": 1,
"alignMode": 1,
...
@@ -8408,13 +8377,13 @@
...
@@ -8408,13 +8377,13 @@
"_active": false,
"_active": false,
"_components": [
"_components": [
{
{
"__id__": 17
4
"__id__": 17
3
},
},
{
{
"__id__": 17
5
"__id__": 17
4
},
},
{
{
"__id__": 17
6
"__id__": 17
5
}
}
],
],
"_prefab": null,
"_prefab": null,
...
@@ -8470,7 +8439,7 @@
...
@@ -8470,7 +8439,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 17
3
"__id__": 17
2
},
},
"_enabled": true,
"_enabled": true,
"alignMode": 2,
"alignMode": 2,
...
@@ -8497,7 +8466,7 @@
...
@@ -8497,7 +8466,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 17
3
"__id__": 17
2
},
},
"_enabled": true,
"_enabled": true,
"_normalMaterial": null,
"_normalMaterial": null,
...
@@ -8565,7 +8534,7 @@
...
@@ -8565,7 +8534,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 17
3
"__id__": 17
2
},
},
"_enabled": true,
"_enabled": true,
"_materials": [
"_materials": [
...
@@ -8603,7 +8572,7 @@
...
@@ -8603,7 +8572,7 @@
"_active": true,
"_active": true,
"_components": [
"_components": [
{
{
"__id__": 17
8
"__id__": 17
7
}
}
],
],
"_prefab": null,
"_prefab": null,
...
@@ -8659,7 +8628,7 @@
...
@@ -8659,7 +8628,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 17
7
"__id__": 17
6
},
},
"_enabled": true,
"_enabled": true,
"_layoutSize": {
"_layoutSize": {
...
@@ -8695,10 +8664,10 @@
...
@@ -8695,10 +8664,10 @@
},
},
"_children": [
"_children": [
{
{
"__id__": 1
80
"__id__": 1
79
},
},
{
{
"__id__": 18
3
"__id__": 18
2
}
}
],
],
"_active": false,
"_active": false,
...
@@ -8756,16 +8725,16 @@
...
@@ -8756,16 +8725,16 @@
"_name": "loading",
"_name": "loading",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 17
9
"__id__": 17
8
},
},
"_children": [],
"_children": [],
"_active": true,
"_active": true,
"_components": [
"_components": [
{
{
"__id__": 18
1
"__id__": 18
0
},
},
{
{
"__id__": 18
2
"__id__": 18
1
}
}
],
],
"_prefab": null,
"_prefab": null,
...
@@ -8821,7 +8790,7 @@
...
@@ -8821,7 +8790,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 1
80
"__id__": 1
79
},
},
"_enabled": true,
"_enabled": true,
"_materials": [
"_materials": [
...
@@ -8853,7 +8822,7 @@
...
@@ -8853,7 +8822,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 1
80
"__id__": 1
79
},
},
"_enabled": true,
"_enabled": true,
"_defaultClip": {
"_defaultClip": {
...
@@ -8872,24 +8841,24 @@
...
@@ -8872,24 +8841,24 @@
"_name": "progress",
"_name": "progress",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 17
9
"__id__": 17
8
},
},
"_children": [
"_children": [
{
{
"__id__": 18
4
"__id__": 18
3
}
}
],
],
"_active": true,
"_active": true,
"_components": [
"_components": [
{
{
"__id__": 18
7
"__id__": 18
6
},
},
{
{
"__id__": 18
8
"__id__": 18
7
}
}
],
],
"_prefab": {
"_prefab": {
"__id__": 18
9
"__id__": 18
8
},
},
"_opacity": 255,
"_opacity": 255,
"_color": {
"_color": {
...
@@ -8943,17 +8912,17 @@
...
@@ -8943,17 +8912,17 @@
"_name": "bar",
"_name": "bar",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 18
3
"__id__": 18
2
},
},
"_children": [],
"_children": [],
"_active": true,
"_active": true,
"_components": [
"_components": [
{
{
"__id__": 18
5
"__id__": 18
4
}
}
],
],
"_prefab": {
"_prefab": {
"__id__": 18
6
"__id__": 18
5
},
},
"_opacity": 255,
"_opacity": 255,
"_color": {
"_color": {
...
@@ -9007,7 +8976,7 @@
...
@@ -9007,7 +8976,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 18
4
"__id__": 18
3
},
},
"_enabled": true,
"_enabled": true,
"_materials": [
"_materials": [
...
@@ -9037,7 +9006,7 @@
...
@@ -9037,7 +9006,7 @@
{
{
"__type__": "cc.PrefabInfo",
"__type__": "cc.PrefabInfo",
"root": {
"root": {
"__id__": 18
3
"__id__": 18
2
},
},
"asset": {
"asset": {
"__uuid__": "3d356c4d-cb23-4239-aa5f-8a913f420fa4"
"__uuid__": "3d356c4d-cb23-4239-aa5f-8a913f420fa4"
...
@@ -9050,7 +9019,7 @@
...
@@ -9050,7 +9019,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 18
3
"__id__": 18
2
},
},
"_enabled": true,
"_enabled": true,
"_materials": [
"_materials": [
...
@@ -9082,7 +9051,7 @@
...
@@ -9082,7 +9051,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 18
3
"__id__": 18
2
},
},
"_enabled": true,
"_enabled": true,
"_id": "3eMT/DXoJNGZT/8Z3nuTUH"
"_id": "3eMT/DXoJNGZT/8Z3nuTUH"
...
@@ -9090,7 +9059,7 @@
...
@@ -9090,7 +9059,7 @@
{
{
"__type__": "cc.PrefabInfo",
"__type__": "cc.PrefabInfo",
"root": {
"root": {
"__id__": 18
3
"__id__": 18
2
},
},
"asset": {
"asset": {
"__uuid__": "3d356c4d-cb23-4239-aa5f-8a913f420fa4"
"__uuid__": "3d356c4d-cb23-4239-aa5f-8a913f420fa4"
...
...
assets/middleLayer_for_debug/script/middleLayer.js
View file @
44973cb8
import
{
initAir
}
from
"
./air
"
;
import
{
initAir
}
from
'
./air
'
;
cc
.
Class
({
cc
.
Class
({
extends
:
cc
.
Component
,
extends
:
cc
.
Component
,
properties
:
{
properties
:
{},
},
callNetworkApiPost
(
baseUrl
,
uri
,
data
,
callBack
)
{
callNetworkApiPost
(
baseUrl
,
uri
,
data
,
callBack
)
{
this
.
getBaseUrl
((
baseUrl
)
=>
{
this
.
getBaseUrl
((
baseUrl
)
=>
{
const
xhr
=
new
XMLHttpRequest
();
const
xhr
=
new
XMLHttpRequest
();
const
url
=
`
${
baseUrl
}${
uri
}
`
;
const
url
=
`
${
baseUrl
}${
uri
}
`
;
xhr
.
open
(
"
POST
"
,
url
,
true
);
xhr
.
open
(
"
POST
"
,
url
,
true
);
xhr
.
setRequestHeader
(
"
content-type
"
,
"
application/json
"
);
xhr
.
setRequestHeader
(
'
content-type
'
,
'
application/json
'
);
xhr
.
onreadystatechange
=
()
=>
{
xhr
.
onreadystatechange
=
()
=>
{
if
(
xhr
.
readyState
==
4
)
{
if
(
xhr
.
readyState
==
4
)
{
callBack
(
JSON
.
parse
(
xhr
.
responseText
));
callBack
(
JSON
.
parse
(
xhr
.
responseText
));
}
}
};
}
xhr
.
send
(
JSON
.
stringify
(
data
));
xhr
.
send
(
JSON
.
stringify
(
data
));
});
});
},
},
callNetworkApiGet
(
baseUrl
,
uri
,
data
,
callBack
)
{
callNetworkApiGet
(
baseUrl
,
uri
,
data
,
callBack
)
{
this
.
getBaseUrl
((
baseUrl
)
=>
{
this
.
getBaseUrl
((
baseUrl
)
=>
{
let
queryStr
=
"
?
"
;
let
queryStr
=
'
?
'
;
const
params
=
[];
const
params
=
[];
for
(
const
key
in
data
)
{
for
(
const
key
in
data
)
{
if
(
Object
.
hasOwnProperty
.
call
(
data
,
key
))
{
if
(
Object
.
hasOwnProperty
.
call
(
data
,
key
))
{
params
.
push
(
`
${
key
}
=
${
data
[
key
]}
`
);
params
.
push
(
`
${
key
}
=
${
data
[
key
]}
`
);
}
}
}
}
queryStr
+=
params
.
join
(
"
&
"
);
queryStr
+=
params
.
join
(
"
&
"
);
const
xhr
=
new
XMLHttpRequest
();
const
xhr
=
new
XMLHttpRequest
();
xhr
.
onreadystatechange
=
()
=>
{
xhr
.
onreadystatechange
=
()
=>
{
if
(
xhr
.
readyState
==
4
&&
xhr
.
status
>=
200
&&
xhr
.
status
<
400
)
{
if
(
xhr
.
readyState
==
4
&&
(
xhr
.
status
>=
200
&&
xhr
.
status
<
400
))
{
callBack
(
xhr
.
responseText
);
callBack
(
xhr
.
responseText
);
}
}
};
};
const
url
=
`
${
baseUrl
}${
uri
}${
queryStr
}
`
;
const
url
=
`
${
baseUrl
}${
uri
}${
queryStr
}
`
;
console
.
log
(
"
url =
"
+
url
);
console
.
log
(
'
url =
'
+
url
);
xhr
.
open
(
"
GET
"
,
url
,
true
);
xhr
.
open
(
'
GET
'
,
url
,
true
);
xhr
.
send
();
xhr
.
send
();
});
});
},
},
callNetworkApiGetLocal
(
baseUrl
,
uri
,
data
,
callBack
)
{
callNetworkApiGetLocal
(
baseUrl
,
uri
,
data
,
callBack
)
{
let
queryStr
=
"
?
"
;
let
queryStr
=
'
?
'
;
const
params
=
[];
const
params
=
[];
for
(
const
key
in
data
)
{
for
(
const
key
in
data
)
{
if
(
Object
.
hasOwnProperty
.
call
(
data
,
key
))
{
if
(
Object
.
hasOwnProperty
.
call
(
data
,
key
))
{
params
.
push
(
`
${
key
}
=
${
data
[
key
]}
`
);
params
.
push
(
`
${
key
}
=
${
data
[
key
]}
`
);
}
}
}
}
queryStr
+=
params
.
join
(
"
&
"
);
queryStr
+=
params
.
join
(
"
&
"
);
const
xhr
=
new
XMLHttpRequest
();
const
xhr
=
new
XMLHttpRequest
();
xhr
.
onreadystatechange
=
()
=>
{
xhr
.
onreadystatechange
=
()
=>
{
if
(
xhr
.
readyState
==
4
&&
xhr
.
status
>=
200
&&
xhr
.
status
<
400
)
{
if
(
xhr
.
readyState
==
4
&&
(
xhr
.
status
>=
200
&&
xhr
.
status
<
400
))
{
callBack
(
xhr
.
responseText
);
callBack
(
xhr
.
responseText
);
}
}
};
};
const
url
=
`
${
baseUrl
}${
uri
}${
queryStr
}
`
;
const
url
=
`
${
baseUrl
}${
uri
}${
queryStr
}
`
;
console
.
log
(
"
url =
"
+
url
);
console
.
log
(
'
url =
'
+
url
);
xhr
.
open
(
"
GET
"
,
url
,
true
);
xhr
.
open
(
'
GET
'
,
url
,
true
);
xhr
.
send
();
xhr
.
send
();
},
},
// 需要预加载的数量
// 需要预加载的数量
preloadCount
:
null
,
preloadCount
:
null
,
// 统计已加载的数量
// 统计已加载的数量
loadedCount
:
null
,
loadedCount
:
null
,
// 统一释放异步资源的方法
// 统一释放异步资源的方法
onLoad
()
{
onLoad
()
{
this
.
preloadCount
=
0
;
this
.
preloadCount
=
0
;
this
.
loadedCount
=
0
;
this
.
loadedCount
=
0
;
initAir
(
this
);
initAir
(
this
);
// this.preloadAll();
// this.preloadAll();
},
},
getBaseUrl
(
callback
)
{
getBaseUrl
(
callback
)
{
if
(
window
.
air
.
engineInfo
)
{
if
(
window
.
air
.
engineInfo
){
if
(
window
.
air
.
engineInfo
.
isDev
==
1
)
{
if
(
window
.
air
.
engineInfo
.
isDev
==
1
){
callback
(
"
https://staging-teach.ireadabc.com
"
);
callback
(
'
https://staging-teach.ireadabc.com
'
);
}
else
{
}
else
{
callback
(
"
https://iteachabc.com
"
);
callback
(
'
https://iteachabc.com
'
);
}
}
}
else
{
}
else
{
window
.
courseware
.
getEngineInfo
(()
=>
{
window
.
courseware
.
getEngineInfo
(()
=>
{
if
(
window
.
air
.
engineInfo
.
isDev
==
1
)
{
if
(
window
.
air
.
engineInfo
.
isDev
==
1
){
callback
(
"
https://staging-teach.ireadabc.com
"
);
callback
(
'
https://staging-teach.ireadabc.com
'
);
}
else
{
}
else
{
callback
(
"
https://iteachabc.com
"
);
callback
(
'
https://iteachabc.com
'
);
}
}
});
});
}
}
},
},
start
()
{
start
()
{
this
.
node
.
zIndex
=
9999
;
this
.
node
.
zIndex
=
9999
;
cc
.
game
.
addPersistRootNode
(
this
.
node
);
cc
.
game
.
addPersistRootNode
(
this
.
node
);
this
.
initListener
();
this
.
initListener
();
const
addressText
=
cc
.
find
(
"
middleLayer/ui/address
"
);
const
addressText
=
cc
.
find
(
'
middleLayer/ui/address
'
);
const
str
=
cc
.
sys
.
localStorage
.
getItem
(
"
ip
"
);
const
str
=
cc
.
sys
.
localStorage
.
getItem
(
'
ip
'
);
console
.
log
(
"
str =
"
+
str
);
console
.
log
(
'
str =
'
+
str
);
if
(
str
)
{
if
(
str
)
{
addressText
.
getComponent
(
cc
.
EditBox
).
string
=
str
;
addressText
.
getComponent
(
cc
.
EditBox
).
string
=
str
;
}
}
const
nameText
=
cc
.
find
(
"
middleLayer/ui/bundleName
"
);
const
nameText
=
cc
.
find
(
'
middleLayer/ui/bundleName
'
);
const
bundleName
=
cc
.
sys
.
localStorage
.
getItem
(
"
bundleName
"
);
const
bundleName
=
cc
.
sys
.
localStorage
.
getItem
(
'
bundleName
'
);
if
(
bundleName
)
{
if
(
bundleName
)
{
nameText
.
getComponent
(
cc
.
EditBox
).
string
=
bundleName
;
nameText
.
getComponent
(
cc
.
EditBox
).
string
=
bundleName
;
}
}
const
courseIdNode
=
cc
.
find
(
"
middleLayer/ui/courseId
"
);
const
courseIdNode
=
cc
.
find
(
'
middleLayer/ui/courseId
'
);
const
courseId
=
cc
.
sys
.
localStorage
.
getItem
(
"
courseId
"
);
const
courseId
=
cc
.
sys
.
localStorage
.
getItem
(
'
courseId
'
);
if
(
courseId
)
{
if
(
courseId
)
{
courseIdNode
.
getComponent
(
cc
.
EditBox
).
string
=
courseId
;
courseIdNode
.
getComponent
(
cc
.
EditBox
).
string
=
courseId
;
}
}
global
.
middleLayer
=
cc
.
find
(
'
middleLayer
'
).
getComponent
(
'
middleLayer
'
);
const
uiNode
=
cc
.
find
(
"
middleLayer/ui
"
);
uiNode
.
parent
.
getComponent
(
cc
.
Widget
).
updateAlignment
();
middleLayer
.
log
(
"
middleLayer.log('像这样在这里打log')
"
);
const
scale
=
Math
.
min
(
},
uiNode
.
parent
.
width
/
uiNode
.
width
,
uiNode
.
parent
.
height
/
uiNode
.
height
preloadAll
()
{
);
if
(
window
.
preloadBundleAndSourcesFlag
)
{
console
.
log
(
'
scale =
'
+
scale
);
// 只加载一次就行了
uiNode
.
scale
=
scale
;
return
;
}
global
.
middleLayer
=
cc
.
find
(
"
middleLayer
"
).
getComponent
(
"
middleLayer
"
);
window
.
preloadBundleAndSourcesFlag
=
true
;
cc
.
find
(
"
middleLayer/ui/ProgressLabel
"
).
active
=
true
;
middleLayer
.
log
(
"
middleLayer.log('像这样在这里打log')
"
);
cc
.
find
(
'
middleLayer/ui/loadingProgress
'
).
active
=
true
;
},
let
platform
=
"
web_desktop
"
;
if
(
cc
.
sys
.
os
==
cc
.
sys
.
OS_IOS
)
{
preloadAll
()
{
platform
=
"
ios
"
;
if
(
window
.
preloadBundleAndSourcesFlag
)
{
}
else
if
(
cc
.
sys
.
os
==
cc
.
sys
.
OS_ANDROID
)
{
// 只加载一次就行了
platform
=
"
android
"
;
return
;
}
}
this
.
callNetworkApiGet
(
`http://staging-teach.ireadabc.com`
,
`/api/syllabus/v1/allbundles`
,
{
orgid
:
483
,
platform
},
(
datastr
)
=>
{
window
.
preloadBundleAndSourcesFlag
=
true
;
const
data
=
JSON
.
parse
(
datastr
);
cc
.
find
(
"
middleLayer/ui/ProgressLabel
"
).
active
=
true
;
if
(
data
.
rows
&&
data
.
rows
.
length
>
0
)
{
cc
.
find
(
"
middleLayer/ui/loadingProgress
"
).
active
=
true
;
this
.
preloadCount
+=
data
.
rows
.
length
;
let
platform
=
"
web_desktop
"
;
}
if
(
cc
.
sys
.
os
==
cc
.
sys
.
OS_IOS
)
{
this
.
callNetworkApiGet
(
`http://staging-teach.ireadabc.com`
,
`/api/syllabus/v1/allresources`
,
{
orgid
:
483
},
(
datastr1
)
=>
{
platform
=
"
ios
"
;
const
data1
=
JSON
.
parse
(
datastr1
);
}
else
if
(
cc
.
sys
.
os
==
cc
.
sys
.
OS_ANDROID
)
{
if
(
data1
.
rows
&&
data1
.
rows
.
length
>
0
)
{
platform
=
"
android
"
;
this
.
preloadCount
+=
data1
.
rows
.
length
;
}
}
this
.
callNetworkApiGet
(
console
.
log
(
'
data.rows =
'
+
JSON
.
stringify
(
data
.
rows
));
`http://staging-teach.ireadabc.com`
,
this
.
batchPreloadScene
(
data
.
rows
);
`/api/syllabus/v1/allbundles`
,
this
.
preloadSource
(
data1
.
rows
);
{
orgid
:
483
,
platform
},
});
(
datastr
)
=>
{
});
const
data
=
JSON
.
parse
(
datastr
);
},
if
(
data
.
rows
&&
data
.
rows
.
length
>
0
)
{
this
.
preloadCount
+=
data
.
rows
.
length
;
preloadSourceImman
()
{
}
// 测试用
this
.
callNetworkApiGet
(
cc
.
find
(
"
middleLayer/ui/ProgressLabel
"
).
active
=
true
;
`http://staging-teach.ireadabc.com`
,
cc
.
find
(
'
middleLayer/ui/loadingProgress
'
).
active
=
true
;
`/api/syllabus/v1/allresources`
,
this
.
callNetworkApiGet
(
`http://staging-teach.ireadabc.com`
,
`/api/courseware/v1/getresources`
,
{
courseid
:
20894
},
(
datastr1
)
=>
{
{
orgid
:
483
},
const
data1
=
JSON
.
parse
(
datastr1
);
(
datastr1
)
=>
{
if
(
data1
.
rows
&&
data1
.
rows
.
length
>
0
)
{
const
data1
=
JSON
.
parse
(
datastr1
);
this
.
preloadCount
+=
data1
.
rows
.
length
;
if
(
data1
.
rows
&&
data1
.
rows
.
length
>
0
)
{
}
this
.
preloadCount
+=
data1
.
rows
.
length
;
this
.
log
(
'
data1.rows =
'
+
JSON
.
stringify
(
data1
.
rows
));
}
this
.
preloadSource
(
data1
.
rows
);
console
.
log
(
"
data.rows =
"
+
JSON
.
stringify
(
data
.
rows
));
});
this
.
batchPreloadScene
(
data
.
rows
);
},
this
.
preloadSource
(
data1
.
rows
);
}
batchPreloadScene
(
scenes
=
[])
{
);
const
expects
=
[
}
// 'op_03_2',
);
// 'OP10_online',
},
];
const
_this
=
this
;
preloadSourceImman
()
{
let
i
=
0
;
// 测试用
const
load
=
function
()
{
cc
.
find
(
"
middleLayer/ui/ProgressLabel
"
).
active
=
true
;
const
scene
=
scenes
[
i
];
cc
.
find
(
"
middleLayer/ui/loadingProgress
"
).
active
=
true
;
if
(
expects
.
includes
(
scene
.
sceneName
))
{
this
.
callNetworkApiGet
(
_this
.
loadedCount
++
;
`http://staging-teach.ireadabc.com`
,
_this
.
updateProcessBar
();
`/api/courseware/v1/getresources`
,
i
++
;
{
courseid
:
20894
},
if
(
i
<
scenes
.
length
)
{
(
datastr1
)
=>
{
setTimeout
(()
=>
{
const
data1
=
JSON
.
parse
(
datastr1
);
load
();
if
(
data1
.
rows
&&
data1
.
rows
.
length
>
0
)
{
},
1
);
this
.
preloadCount
+=
data1
.
rows
.
length
;
}
}
return
;
this
.
log
(
"
data1.rows =
"
+
JSON
.
stringify
(
data1
.
rows
));
}
this
.
preloadSource
(
data1
.
rows
);
cc
.
assetManager
.
loadBundle
(
scene
.
bondleUrl
,
{
version
:
scene
.
version
},
(
err
,
bundle
)
=>
{
}
console
.
log
(
`
${
scene
.
bondleUrl
}
---场景开始loadBundle----`
);
);
if
(
!
bundle
)
{
},
_this
.
loadedCount
++
;
_this
.
updateProcessBar
();
batchPreloadScene
(
scenes
=
[])
{
i
++
;
const
expects
=
[
if
(
i
<
scenes
.
length
)
{
// 'op_03_2',
setTimeout
(()
=>
{
// 'OP10_online',
load
();
];
},
1
);
const
_this
=
this
;
}
let
i
=
0
;
return
;
const
load
=
function
()
{
}
const
scene
=
scenes
[
i
];
bundle
.
preloadScene
(
scene
.
sceneName
,
()
=>
{
},
()
=>
{
if
(
expects
.
includes
(
scene
.
sceneName
))
{
console
.
log
(
`
${
scene
.
sceneName
}
场景预加载结束`
);
_this
.
loadedCount
++
;
_this
.
loadedCount
++
;
_this
.
updateProcessBar
();
_this
.
updateProcessBar
();
i
++
;
i
++
;
if
(
i
<
scenes
.
length
)
{
if
(
i
<
scenes
.
length
)
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
load
();
load
();
},
1
);
},
1
);
}
}
return
;
});
}
});
cc
.
assetManager
.
loadBundle
(
}
scene
.
bondleUrl
,
{
version
:
scene
.
version
},
if
(
scenes
&&
scenes
.
length
>
0
)
{
(
err
,
bundle
)
=>
{
load
();
console
.
log
(
`
${
scene
.
bondleUrl
}
---场景开始loadBundle----`
);
}
if
(
!
bundle
)
{
},
_this
.
loadedCount
++
;
_this
.
updateProcessBar
();
preloadSource
(
array
)
{
i
++
;
const
rows
=
array
||
[];
if
(
i
<
scenes
.
length
)
{
const
batchLoad
=
()
=>
{
setTimeout
(()
=>
{
let
tempArr
=
rows
.
splice
(
0
,
10
);
load
();
let
len
=
tempArr
.
length
;
},
1
);
for
(
let
i
=
0
;
i
<
tempArr
.
length
;
i
++
)
{
}
cc
.
assetManager
.
loadRemote
(
tempArr
[
i
],
(
err
,
texture
)
=>
{
return
;
if
(
err
)
{
}
console
.
log
(
err
)
bundle
.
preloadScene
(
}
scene
.
sceneName
,
this
.
loadedCount
++
;
()
=>
{},
this
.
updateProcessBar
();
()
=>
{
if
(
i
===
len
-
1
)
{
console
.
log
(
`
${
scene
.
sceneName
}
场景预加载结束`
);
batchLoad
();
_this
.
loadedCount
++
;
}
_this
.
updateProcessBar
();
});
i
++
;
}
if
(
i
<
scenes
.
length
)
{
}
setTimeout
(()
=>
{
batchLoad
();
load
();
},
},
1
);
}
updateProcessBar
()
{
}
const
label
=
cc
.
find
(
"
middleLayer/ui/ProgressLabel
"
).
getComponent
(
cc
.
Label
);
);
const
loadingProgress
=
cc
.
find
(
'
middleLayer/ui/loadingProgress
'
);
}
label
.
string
=
`正在加载:
${
this
.
loadedCount
}
/
${
this
.
preloadCount
}
`
;
);
if
(
this
.
loadedCount
>
this
.
preloadCount
*
0.99
)
{
};
cc
.
find
(
"
middleLayer/ui/ProgressLabel
"
).
active
=
false
;
loadingProgress
.
active
=
false
;
if
(
scenes
&&
scenes
.
length
>
0
)
{
this
.
showLog
(
"
资源全部加载完成
"
);
load
();
}
}
loadingProgress
.
getComponent
(
cc
.
ProgressBar
).
progress
=
this
.
loadedCount
/
this
.
preloadCount
;
},
},
preloadSource
(
array
)
{
asyncDelayLog
(
str
)
{
const
rows
=
array
||
[];
console
.
log
(
str
);
const
batchLoad
=
()
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
let
tempArr
=
rows
.
splice
(
0
,
10
);
setTimeout
(()
=>
{
let
len
=
tempArr
.
length
;
resolve
();
for
(
let
i
=
0
;
i
<
tempArr
.
length
;
i
++
)
{
},
1
);
cc
.
assetManager
.
loadRemote
(
tempArr
[
i
],
(
err
,
texture
)
=>
{
});
if
(
err
)
{
},
console
.
log
(
err
);
}
initListener
()
{
this
.
loadedCount
++
;
const
exitBtn
=
cc
.
find
(
'
middleLayer/ExitBtn
'
);
this
.
updateProcessBar
();
exitBtn
.
on
(
'
click
'
,
()
=>
{
if
(
i
===
len
-
1
)
{
cc
.
find
(
'
middleLayer/BtnRight
'
).
active
=
false
;
batchLoad
();
cc
.
find
(
'
middleLayer/BtnLeft
'
).
active
=
false
;
}
});
cc
.
tween
(
exitBtn
)
}
.
to
(
0.1
,
{
scaleX
:
0.4
,
scaleY
:
0.6
})
};
.
to
(
0.1
,
{
scaleX
:
0.6
,
scaleY
:
0.4
})
batchLoad
();
.
to
(
0.1
,
{
scaleX
:
0.5
,
scaleY
:
0.5
})
},
.
call
(()
=>
{
exitBtn
.
active
=
false
;
updateProcessBar
()
{
cc
.
game
.
removePersistRootNode
(
this
.
node
);
const
label
=
cc
// cc.director.getScene().destroy();
.
find
(
"
middleLayer/ui/ProgressLabel
"
)
cc
.
audioEngine
.
stopAll
();
.
getComponent
(
cc
.
Label
);
window
.
courseware
.
freeAllOcMethod
();
const
loadingProgress
=
cc
.
find
(
"
middleLayer/ui/loadingProgress
"
);
cc
.
director
.
loadScene
(
"
debug_shell
"
,
null
,
null
,
(
err
,
scene
)
=>
{
label
.
string
=
`正在加载:
${
this
.
loadedCount
}
/
${
this
.
preloadCount
}
`
;
if
(
this
.
loadedCount
>
this
.
preloadCount
*
0.99
)
{
});
cc
.
find
(
"
middleLayer/ui/ProgressLabel
"
).
active
=
false
;
})
loadingProgress
.
active
=
false
;
.
start
();
this
.
showLog
(
"
资源全部加载完成
"
);
});
}
loadingProgress
.
getComponent
(
cc
.
ProgressBar
).
progress
=
cc
.
find
(
'
middleLayer/BtnRight
'
).
on
(
'
click
'
,
()
=>
{
this
.
loadedCount
/
this
.
preloadCount
;
this
.
goNextPage
();
},
});
asyncDelayLog
(
str
)
{
cc
.
find
(
'
middleLayer/BtnLeft
'
).
on
(
'
click
'
,
()
=>
{
console
.
log
(
str
);
this
.
goPrePage
();
return
new
Promise
((
resolve
,
reject
)
=>
{
});
setTimeout
(()
=>
{
resolve
();
cc
.
find
(
'
middleLayer/ui/BtnOpenOsmo
'
).
on
(
'
click
'
,
()
=>
{
},
1
);
window
.
courseware
.
openOsmo
();
});
});
},
cc
.
find
(
'
middleLayer/ui/BtnCloseOsmo
'
).
on
(
'
click
'
,
()
=>
{
initListener
()
{
window
.
courseware
.
closeOsmo
();
const
exitBtn
=
cc
.
find
(
"
middleLayer/ExitBtn
"
);
});
exitBtn
.
on
(
"
click
"
,
()
=>
{
cc
.
find
(
"
middleLayer/BtnRight
"
).
active
=
false
;
cc
.
find
(
'
middleLayer/ui/BtnOpenRecord
'
).
on
(
'
click
'
,
()
=>
{
cc
.
find
(
"
middleLayer/BtnLeft
"
).
active
=
false
;
window
.
courseware
.
startRecord
(
1
);
});
cc
.
tween
(
exitBtn
)
.
to
(
0.1
,
{
scaleX
:
0.4
,
scaleY
:
0.6
})
cc
.
find
(
'
middleLayer/ui/BtnCloseRecord
'
).
on
(
'
click
'
,
()
=>
{
.
to
(
0.1
,
{
scaleX
:
0.6
,
scaleY
:
0.4
})
window
.
courseware
.
stopRecord
(
res
=>
{
.
to
(
0.1
,
{
scaleX
:
0.5
,
scaleY
:
0.5
})
this
.
log
(
'
--------录音返回结果 stopRecord ------------
'
);
.
call
(()
=>
{
this
.
log
(
JSON
.
stringify
(
res
))
exitBtn
.
active
=
false
;
this
.
log
(
'
------------------------------
'
);
cc
.
game
.
removePersistRootNode
(
this
.
node
);
});
// cc.director.getScene().destroy();
});
cc
.
audioEngine
.
stopAll
();
window
.
courseware
.
freeAllOcMethod
();
cc
.
find
(
'
middleLayer/ui/BtnOpenTest
'
).
on
(
'
click
'
,
()
=>
{
cc
.
director
.
loadScene
(
"
debug_shell
"
,
null
,
null
,
(
err
,
scene
)
=>
{});
window
.
courseware
.
startTest
(
''
);
})
});
.
start
();
});
cc
.
find
(
'
middleLayer/ui/BtnCloseTest
'
).
on
(
'
click
'
,
()
=>
{
window
.
courseware
.
stopTest
(
res
=>
{
cc
.
find
(
"
middleLayer/BtnRight
"
).
on
(
"
click
"
,
()
=>
{
this
.
log
(
'
--------录音评测返回结果 stopTest ---------
'
);
this
.
goNextPage
();
this
.
log
(
JSON
.
stringify
(
res
))
});
this
.
log
(
'
------------------------------
'
);
});
cc
.
find
(
"
middleLayer/BtnLeft
"
).
on
(
"
click
"
,
()
=>
{
});
this
.
goPrePage
();
});
const
BtnStartLocal
=
cc
.
find
(
'
middleLayer/ui/BtnStartLocal
'
);
BtnStartLocal
.
on
(
'
click
'
,
()
=>
{
cc
.
find
(
"
middleLayer/ui/BtnOpenOsmo
"
).
on
(
"
click
"
,
()
=>
{
const
addressText
=
cc
.
find
(
'
middleLayer/ui/address
'
);
window
.
courseware
.
openOsmo
();
const
str
=
addressText
.
getComponent
(
cc
.
EditBox
).
string
;
});
cc
.
sys
.
localStorage
.
setItem
(
'
ip
'
,
str
);
const
address
=
str
.
split
(
'
:
'
)[
0
];
cc
.
find
(
"
middleLayer/ui/BtnCloseOsmo
"
).
on
(
"
click
"
,
()
=>
{
const
port
=
str
.
split
(
'
:
'
)[
0
]
|
8081
;
window
.
courseware
.
closeOsmo
();
this
.
localMode
=
true
;
});
this
.
loadLocalBundle
(
address
,
port
);
this
.
showWaitingLetters
();
cc
.
find
(
"
middleLayer/ui/BtnOpenRecord
"
).
on
(
"
click
"
,
()
=>
{
this
.
hideUI
();
window
.
courseware
.
startRecord
(
1
);
this
.
showDebugUI
();
});
});
cc
.
find
(
"
middleLayer/ui/BtnCloseRecord
"
).
on
(
"
click
"
,
()
=>
{
const
BtnStartOnline
=
cc
.
find
(
'
middleLayer/ui/BtnStartOnline
'
);
window
.
courseware
.
stopRecord
((
res
)
=>
{
BtnStartOnline
.
on
(
'
click
'
,
()
=>
{
this
.
log
(
"
--------录音返回结果 stopRecord ------------
"
);
const
nameText
=
cc
.
find
(
'
middleLayer/ui/bundleName
'
);
this
.
log
(
JSON
.
stringify
(
res
));
const
bundleName
=
nameText
.
getComponent
(
cc
.
EditBox
).
string
;
this
.
log
(
"
------------------------------
"
);
cc
.
sys
.
localStorage
.
setItem
(
'
bundleName
'
,
bundleName
);
});
this
.
loadOnlineBundle
(
bundleName
);
});
this
.
showDebugUI
();
});
cc
.
find
(
"
middleLayer/ui/BtnOpenTest
"
).
on
(
"
click
"
,
()
=>
{
window
.
courseware
.
startTest
(
""
);
const
BtnStartCourseWare
=
cc
.
find
(
'
middleLayer/ui/BtnStartCourseWare
'
);
});
BtnStartCourseWare
.
on
(
'
click
'
,
()
=>
{
const
courseIdNode
=
cc
.
find
(
'
middleLayer/ui/courseId
'
);
cc
.
find
(
"
middleLayer/ui/BtnCloseTest
"
).
on
(
"
click
"
,
()
=>
{
const
courseId
=
courseIdNode
.
getComponent
(
cc
.
EditBox
).
string
;
window
.
courseware
.
stopTest
((
res
)
=>
{
cc
.
sys
.
localStorage
.
setItem
(
'
courseId
'
,
courseId
);
this
.
log
(
"
--------录音评测返回结果 stopTest ---------
"
);
this
.
loadOnlineCourseWare
(
courseId
);
this
.
log
(
JSON
.
stringify
(
res
));
this
.
showDebugUI
();
this
.
log
(
"
------------------------------
"
);
});
});
});
const
BtnLoad
=
cc
.
find
(
'
middleLayer/ui/BtnLoad
'
);
BtnLoad
.
on
(
'
click
'
,
()
=>
{
const
BtnStartLocal
=
cc
.
find
(
"
middleLayer/ui/BtnStartLocal
"
);
this
.
preloadCount
=
0
;
BtnStartLocal
.
on
(
"
click
"
,
()
=>
{
this
.
loadedCount
=
0
;
const
addressText
=
cc
.
find
(
"
middleLayer/ui/address
"
);
cc
.
find
(
"
middleLayer/ui/ProgressLabel
"
).
active
=
true
;
const
str
=
addressText
.
getComponent
(
cc
.
EditBox
).
string
;
cc
.
find
(
'
middleLayer/ui/loadingProgress
'
).
active
=
true
;
cc
.
sys
.
localStorage
.
setItem
(
"
ip
"
,
str
);
// this.preloadAll();
const
address
=
str
.
split
(
"
:
"
)[
0
];
this
.
preloadSourceImman
();
const
port
=
str
.
split
(
"
:
"
)[
0
]
|
8081
;
});
this
.
localMode
=
true
;
this
.
loadLocalBundle
(
address
,
port
);
const
btnClose
=
cc
.
find
(
'
middleLayer/ConsoleNode/BtnClose
'
);
this
.
showWaitingLetters
();
const
btnOpen
=
cc
.
find
(
'
middleLayer/ConsoleNode/BtnOpen
'
);
this
.
hideUI
();
const
consoleNode
=
cc
.
find
(
'
middleLayer/ConsoleNode/Console
'
);
this
.
showDebugUI
();
const
consoleBg
=
cc
.
find
(
'
middleLayer/ConsoleNode/bg
'
);
});
btnOpen
.
on
(
'
click
'
,
()
=>
{
btnClose
.
active
=
true
;
const
BtnStartOnline
=
cc
.
find
(
"
middleLayer/ui/BtnStartOnline
"
);
btnOpen
.
active
=
false
;
BtnStartOnline
.
on
(
"
click
"
,
()
=>
{
consoleNode
.
active
=
true
;
const
nameText
=
cc
.
find
(
"
middleLayer/ui/bundleName
"
);
consoleBg
.
active
=
true
;
const
bundleName
=
nameText
.
getComponent
(
cc
.
EditBox
).
string
;
});
cc
.
sys
.
localStorage
.
setItem
(
"
bundleName
"
,
bundleName
);
this
.
loadOnlineBundle
(
bundleName
);
btnClose
.
on
(
'
click
'
,
()
=>
{
this
.
showDebugUI
();
btnClose
.
active
=
false
;
});
btnOpen
.
active
=
true
;
consoleNode
.
active
=
false
;
const
BtnStartCourseWare
=
cc
.
find
(
"
middleLayer/ui/BtnStartCourseWare
"
);
consoleBg
.
active
=
false
;
BtnStartCourseWare
.
on
(
"
click
"
,
()
=>
{
});
const
courseIdNode
=
cc
.
find
(
"
middleLayer/ui/courseId
"
);
},
const
courseId
=
courseIdNode
.
getComponent
(
cc
.
EditBox
).
string
;
cc
.
sys
.
localStorage
.
setItem
(
"
courseId
"
,
courseId
);
goPrePage
()
{
this
.
loadOnlineCourseWare
(
courseId
);
this
.
goTarIndexPage
(
this
.
courseIndex
-
1
);
this
.
showDebugUI
();
},
});
goNextPage
()
{
this
.
goTarIndexPage
(
this
.
courseIndex
+
1
);
const
BtnLoad
=
cc
.
find
(
"
middleLayer/ui/BtnLoad
"
);
},
BtnLoad
.
on
(
"
click
"
,
()
=>
{
goTarIndexPage
(
index
)
{
this
.
preloadCount
=
0
;
if
(
!
this
.
courses
||
index
==
this
.
courseIndex
||
index
<
0
||
index
>
this
.
courses
.
length
-
1
)
{
this
.
loadedCount
=
0
;
return
;
cc
.
find
(
"
middleLayer/ui/ProgressLabel
"
).
active
=
true
;
}
cc
.
find
(
"
middleLayer/ui/loadingProgress
"
).
active
=
true
;
// this.preloadAll();
window
.
courseware
.
freeAllOcMethod
();
this
.
preloadSourceImman
();
});
this
.
courseIndex
=
index
;
this
.
courseItem
=
this
.
courses
[
this
.
courseIndex
];
const
btnClose
=
cc
.
find
(
"
middleLayer/ConsoleNode/BtnClose
"
);
if
(
this
.
courseIndex
==
0
)
{
const
btnOpen
=
cc
.
find
(
"
middleLayer/ConsoleNode/BtnOpen
"
);
cc
.
find
(
'
middleLayer/BtnLeft
'
).
active
=
false
;
const
consoleNode
=
cc
.
find
(
"
middleLayer/ConsoleNode/Console
"
);
}
else
{
const
consoleBg
=
cc
.
find
(
"
middleLayer/ConsoleNode/bg
"
);
cc
.
find
(
'
middleLayer/BtnLeft
'
).
active
=
false
;
btnOpen
.
on
(
"
click
"
,
()
=>
{
}
btnClose
.
active
=
true
;
if
(
this
.
courseIndex
==
this
.
courses
.
length
-
1
)
{
btnOpen
.
active
=
false
;
cc
.
find
(
'
middleLayer/BtnRight
'
).
active
=
false
;
consoleNode
.
active
=
true
;
}
else
{
consoleBg
.
active
=
true
;
cc
.
find
(
'
middleLayer/BtnRight
'
).
active
=
true
;
});
}
this
.
loadPageBundle
();
btnClose
.
on
(
"
click
"
,
()
=>
{
},
btnClose
.
active
=
false
;
log
(
str
)
{
btnOpen
.
active
=
true
;
const
logStr
=
`
${
new
Date
().
toLocaleString
()}
:
${
str
}
`
;
consoleNode
.
active
=
false
;
console
.
log
(
logStr
);
consoleBg
.
active
=
false
;
const
content
=
cc
.
instantiate
(
cc
.
find
(
'
middleLayer/ConsoleNode/content
'
));
});
content
.
active
=
true
;
},
const
label
=
content
.
getChildByName
(
'
label
'
);
label
.
getComponent
(
cc
.
Label
).
string
=
logStr
;
goPrePage
()
{
const
consoleContent
=
cc
.
find
(
'
middleLayer/ConsoleNode/Console/content
'
);
this
.
goTarIndexPage
(
this
.
courseIndex
-
1
);
consoleContent
.
addChild
(
content
);
},
consoleContent
.
getComponent
(
cc
.
Layout
).
updateLayout
();
goNextPage
()
{
},
this
.
goTarIndexPage
(
this
.
courseIndex
+
1
);
hideUI
()
{
},
cc
.
find
(
'
middleLayer/ui
'
).
active
=
false
;
goTarIndexPage
(
index
)
{
},
if
(
loadOnlineBundle
(
bundleName
)
{
!
this
.
courses
||
this
.
hideUI
();
index
==
this
.
courseIndex
||
this
.
showWaitingLetters
();
index
<
0
||
this
.
callNetworkApiGet
(
`http://staging-teach.ireadabc.com`
,
`/api/template/v1/
${
bundleName
}
`
,
{},
(
datastr
)
=>
{
index
>
this
.
courses
.
length
-
1
const
data
=
JSON
.
parse
(
datastr
);
)
{
let
configData
=
null
;
return
;
if
(
cc
.
sys
.
os
==
cc
.
sys
.
OS_IOS
)
{
}
configData
=
data
.
data
.
conf
.
ios
;
}
else
if
(
cc
.
sys
.
os
==
cc
.
sys
.
OS_ANDROID
)
{
window
.
courseware
.
freeAllOcMethod
();
configData
=
data
.
data
.
conf
.
android
;
}
else
{
this
.
courseIndex
=
index
;
configData
=
data
.
data
.
conf
.
web_desktop
;
this
.
courseItem
=
this
.
courses
[
this
.
courseIndex
];
}
if
(
this
.
courseIndex
==
0
)
{
const
sceneName
=
configData
.
sceneName
;
cc
.
find
(
"
middleLayer/BtnLeft
"
).
active
=
false
;
const
version
=
configData
.
version
;
}
else
{
const
bondleUrl
=
configData
.
bondleUrl
;
cc
.
find
(
"
middleLayer/BtnLeft
"
).
active
=
false
;
this
.
loadBundle
(
sceneName
,
version
,
bondleUrl
);
}
});
if
(
this
.
courseIndex
==
this
.
courses
.
length
-
1
)
{
},
cc
.
find
(
"
middleLayer/BtnRight
"
).
active
=
false
;
courses
:
null
,
}
else
{
courseIndex
:
0
,
cc
.
find
(
"
middleLayer/BtnRight
"
).
active
=
true
;
courseItem
:
null
,
}
loadOnlineCourseWare
(
courseId
,
linkFlag
)
{
this
.
loadPageBundle
();
this
.
hideUI
();
},
this
.
showWaitingLetters
();
log
(
str
)
{
const
logStr
=
`
${
new
Date
().
toLocaleString
()}
:
${
str
}
`
;
let
api
=
`/api/courseware/v1/
${
courseId
}
/list`
;
console
.
log
(
logStr
);
if
(
linkFlag
===
true
)
{
const
content
=
cc
.
instantiate
(
cc
.
find
(
"
middleLayer/ConsoleNode/content
"
));
api
=
`/api/courseware/v1/
${
courseId
}
/eq/level/list`
;
content
.
active
=
true
;
}
const
label
=
content
.
getChildByName
(
"
label
"
);
this
.
callNetworkApiGet
(
`http://staging-teach.ireadabc.com`
,
api
,
{},
(
datastr
)
=>
{
label
.
getComponent
(
cc
.
Label
).
string
=
logStr
;
const
data
=
JSON
.
parse
(
datastr
);
const
consoleContent
=
cc
.
find
(
"
middleLayer/ConsoleNode/Console/content
"
);
if
(
data
.
rows
&&
data
.
rows
.
length
>
0
)
{
consoleContent
.
addChild
(
content
);
this
.
courses
=
data
.
rows
;
consoleContent
.
getComponent
(
cc
.
Layout
).
updateLayout
();
this
.
courseIndex
=
data
.
index
||
0
;
},
this
.
courseItem
=
data
.
rows
[
this
.
courseIndex
];
hideUI
()
{
}
cc
.
find
(
"
middleLayer/ui
"
).
active
=
false
;
if
(
this
.
courses
&&
this
.
courses
.
length
>
1
&&
this
.
courseIndex
<=
this
.
courses
.
length
-
1
)
{
},
cc
.
find
(
'
middleLayer/BtnRight
'
).
active
=
true
;
loadOnlineBundle
(
bundleName
)
{
}
this
.
hideUI
();
if
(
this
.
courseIndex
>
0
)
{
this
.
showWaitingLetters
();
cc
.
find
(
'
middleLayer/BtnLeft
'
).
active
=
false
;
this
.
callNetworkApiGet
(
}
`http://staging-teach.ireadabc.com`
,
this
.
reWriteAir
();
`/api/template/v1/
${
bundleName
}
`
,
this
.
loadPageBundle
();
{},
});
(
datastr
)
=>
{
},
const
data
=
JSON
.
parse
(
datastr
);
loadLocalBundle
(
address
,
port
)
{
let
configData
=
null
;
this
.
callNetworkApiGetLocal
(
`http://
${
address
}
:
${
port
}
`
,
'
/dist/config.json
'
,
{},
(
datastr
)
=>
{
if
(
cc
.
sys
.
os
==
cc
.
sys
.
OS_IOS
)
{
const
data
=
JSON
.
parse
(
datastr
);
configData
=
data
.
data
.
conf
.
ios
;
let
sceneName
=
''
;
}
else
if
(
cc
.
sys
.
os
==
cc
.
sys
.
OS_ANDROID
)
{
let
version
=
''
;
configData
=
data
.
data
.
conf
.
android
;
let
bondleUrl
=
''
;
}
else
{
if
(
cc
.
sys
.
os
==
cc
.
sys
.
OS_IOS
)
{
configData
=
data
.
data
.
conf
.
web_desktop
;
sceneName
=
data
.
ios
.
sceneName
;
}
version
=
data
.
ios
.
version
;
const
sceneName
=
configData
.
sceneName
;
bondleUrl
=
`http://
${
address
}
:
${
port
}
/dist/ios/
${
sceneName
}
/`
;
const
version
=
configData
.
version
;
}
else
if
(
cc
.
sys
.
os
==
cc
.
sys
.
OS_ANDROID
)
{
const
bondleUrl
=
configData
.
bondleUrl
;
sceneName
=
data
.
android
.
sceneName
;
this
.
loadBundle
(
sceneName
,
version
,
bondleUrl
);
version
=
data
.
android
.
version
;
}
bondleUrl
=
`http://
${
address
}
:
${
port
}
/dist/android/
${
sceneName
}
/`
;
);
}
else
{
},
sceneName
=
data
.
android
.
sceneName
;
courses
:
null
,
version
=
""
;
courseIndex
:
0
,
bondleUrl
=
`http://
${
address
}
:
${
port
}
/dist/web_desktop/`
;
courseItem
:
null
,
}
loadOnlineCourseWare
(
courseId
,
linkFlag
)
{
this
.
loadBundle
(
sceneName
,
version
,
bondleUrl
);
this
.
hideUI
();
});
this
.
showWaitingLetters
();
},
loadPageBundle
()
{
let
api
=
`/api/courseware/v1/
${
courseId
}
/list`
;
let
sceneName
,
version
,
bondleUrl
=
""
;
if
(
linkFlag
===
true
)
{
if
(
cc
.
sys
.
os
==
cc
.
sys
.
OS_IOS
)
{
api
=
`/api/courseware/v1/
${
courseId
}
/eq/level/list`
;
sceneName
=
this
.
courseItem
.
conf
.
ios
.
sceneName
;
}
version
=
this
.
courseItem
.
conf
.
ios
.
version
;
this
.
callNetworkApiGet
(
bondleUrl
=
this
.
courseItem
.
conf
.
ios
.
bondleUrl
;
`http://staging-teach.ireadabc.com`
,
}
else
if
(
cc
.
sys
.
os
==
cc
.
sys
.
OS_ANDROID
)
{
api
,
sceneName
=
this
.
courseItem
.
conf
.
android
.
sceneName
;
{},
version
=
this
.
courseItem
.
conf
.
android
.
version
;
(
datastr
)
=>
{
bondleUrl
=
this
.
courseItem
.
conf
.
android
.
bondleUrl
;
const
data
=
JSON
.
parse
(
datastr
);
}
else
{
if
(
data
.
rows
&&
data
.
rows
.
length
>
0
)
{
sceneName
=
this
.
courseItem
.
conf
.
web_desktop
.
sceneName
;
this
.
courses
=
data
.
rows
;
version
=
this
.
courseItem
.
conf
.
web_desktop
.
version
;
this
.
courseIndex
=
data
.
index
||
0
;
bondleUrl
=
this
.
courseItem
.
conf
.
web_desktop
.
bondleUrl
;
this
.
courseItem
=
data
.
rows
[
this
.
courseIndex
];
}
}
if
(
this
.
loadBundle
(
sceneName
,
version
,
bondleUrl
);
this
.
courses
&&
},
this
.
courses
.
length
>
1
&&
loadBundle
(
sceneName
,
version
,
bondleUrl
)
{
this
.
courseIndex
<=
this
.
courses
.
length
-
1
this
.
currentBundleInfo
=
{
sceneName
,
version
,
bondleUrl
};
)
{
this
.
showMask
();
cc
.
find
(
"
middleLayer/BtnRight
"
).
active
=
true
;
this
.
showWaitingLetters
();
}
cc
.
assetManager
.
loadBundle
(
bondleUrl
,
{
version
:
version
},
async
(
err
,
bundle
)
=>
{
if
(
this
.
courseIndex
>
0
)
{
if
(
err
)
{
cc
.
find
(
"
middleLayer/BtnLeft
"
).
active
=
false
;
return
this
.
asyncDelayLog
(
err
);
}
}
this
.
reWriteAir
();
bundle
.
loadScene
(
sceneName
,
null
,
null
,
(
err
,
scene
)
=>
{
this
.
loadPageBundle
();
if
(
err
)
{
}
this
.
asyncDelayLog
(
'
err:
'
,
err
);
);
}
},
cc
.
audioEngine
.
stopAll
();
loadLocalBundle
(
address
,
port
)
{
cc
.
director
.
runScene
(
scene
,
null
,
()
=>
{
this
.
callNetworkApiGetLocal
(
console
.
log
(
'
sceneName =
'
+
sceneName
);
`http://
${
address
}
:
${
port
}
`
,
const
Canvas
=
cc
.
find
(
'
Canvas
'
);
"
/dist/config.json
"
,
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
);
{},
cc
.
find
(
'
middleLayer/ExitBtn
'
).
active
=
true
;
(
datastr
)
=>
{
this
.
hideWaitingLetters
();
const
data
=
JSON
.
parse
(
datastr
);
this
.
hideMask
();
let
sceneName
=
""
;
Canvas
.
getComponent
(
cc
.
Widget
).
updateAlignment
();
let
version
=
""
;
middleLayer
.
scale
=
Canvas
.
width
/
middleLayer
.
width
;
let
bondleUrl
=
""
;
// this.showLog('middleLayer.scale = ' + middleLayer.scale);
if
(
cc
.
sys
.
os
==
cc
.
sys
.
OS_IOS
)
{
});
sceneName
=
data
.
ios
.
sceneName
;
});
version
=
data
.
ios
.
version
;
});
bondleUrl
=
`http://
${
address
}
:
${
port
}
/dist/ios/
${
sceneName
}
/`
;
},
}
else
if
(
cc
.
sys
.
os
==
cc
.
sys
.
OS_ANDROID
)
{
sceneName
=
data
.
android
.
sceneName
;
reloadBundle
()
{
version
=
data
.
android
.
version
;
const
{
sceneName
,
version
,
bondleUrl
}
=
this
.
currentBundleInfo
;
bondleUrl
=
`http://
${
address
}
:
${
port
}
/dist/android/
${
sceneName
}
/`
;
}
else
{
this
.
loadBundle
(
sceneName
,
version
,
bondleUrl
);
sceneName
=
data
.
android
.
sceneName
;
},
version
=
""
;
bondleUrl
=
`http://
${
address
}
:
${
port
}
/dist/web_desktop/`
;
showMask
()
{
}
const
mask
=
cc
.
find
(
'
middleLayer/mask
'
);
this
.
loadBundle
(
sceneName
,
version
,
bondleUrl
);
mask
.
active
=
true
;
}
cc
.
tween
(
mask
)
);
.
set
({
opacity
:
0
})
},
.
to
(
0.5
,
{
opacity
:
0
})
loadPageBundle
()
{
.
start
();
let
sceneName
,
},
version
,
bondleUrl
=
""
;
hideMask
()
{
if
(
cc
.
sys
.
os
==
cc
.
sys
.
OS_IOS
)
{
const
mask
=
cc
.
find
(
'
middleLayer/mask
'
);
sceneName
=
this
.
courseItem
.
conf
.
ios
.
sceneName
;
mask
.
stopAllActions
();
version
=
this
.
courseItem
.
conf
.
ios
.
version
;
cc
.
tween
(
mask
)
bondleUrl
=
this
.
courseItem
.
conf
.
ios
.
bondleUrl
;
.
set
({
opacity
:
0
})
}
else
if
(
cc
.
sys
.
os
==
cc
.
sys
.
OS_ANDROID
)
{
.
to
(
0.5
,
{
opacity
:
0
})
sceneName
=
this
.
courseItem
.
conf
.
android
.
sceneName
;
.
call
(()
=>
{
version
=
this
.
courseItem
.
conf
.
android
.
version
;
mask
.
active
=
false
;
bondleUrl
=
this
.
courseItem
.
conf
.
android
.
bondleUrl
;
})
}
else
{
.
start
();
sceneName
=
this
.
courseItem
.
conf
.
web_desktop
.
sceneName
;
},
version
=
this
.
courseItem
.
conf
.
web_desktop
.
version
;
bondleUrl
=
this
.
courseItem
.
conf
.
web_desktop
.
bondleUrl
;
reWriteAir
()
{
}
window
.
courseware
.
getData
=
(
callback
)
=>
{
let
data
=
null
;
this
.
loadBundle
(
sceneName
,
version
,
bondleUrl
);
if
(
this
.
courseItem
.
data
)
{
},
data
=
JSON
.
parse
(
this
.
courseItem
.
data
);
loadBundle
(
sceneName
,
version
,
bondleUrl
)
{
}
this
.
currentBundleInfo
=
{
sceneName
,
version
,
bondleUrl
};
this
.
log
(
"
===成功调用getData===
"
+
this
.
courseItem
.
data
);
this
.
showMask
();
callback
&&
callback
(
data
);
this
.
showWaitingLetters
();
}
cc
.
assetManager
.
loadBundle
(
window
.
courseware
.
nextPage
=
()
=>
{
bondleUrl
,
this
.
goNextPage
();
{
version
:
version
},
}
async
(
err
,
bundle
)
=>
{
window
.
courseware
.
beforePage
=
()
=>
{
if
(
err
)
{
this
.
goPrePage
();
return
this
.
asyncDelayLog
(
err
);
}
}
window
.
courseware
.
sendAnswer
=
(
answerObj
)
=>
{
bundle
.
loadScene
(
sceneName
,
null
,
null
,
(
err
,
scene
)
=>
{
this
.
log
(
"
===成功调用sendAnswer===
"
+
JSON
.
stringify
(
answerObj
));
if
(
err
)
{
this
.
callNetworkApiPost
(
`http://staging-teach.ireadabc.com`
,
`/api/oxford/courseware/v1/
${
this
.
courseItem
.
id
}
/saveanswer`
,
answerObj
,
(
data
)
=>
{
this
.
asyncDelayLog
(
"
err:
"
,
err
);
answerObj
.
callback
&&
answerObj
.
callback
(
JSON
.
stringify
(
data
.
row
));
}
});
cc
.
audioEngine
.
stopAll
();
}
cc
.
director
.
runScene
(
scene
,
null
,
()
=>
{
window
.
courseware
.
getAnswer
=
(
queryObj
,
callback
)
=>
{
console
.
log
(
"
sceneName =
"
+
sceneName
);
this
.
log
(
"
===成功调用getAnswer===
"
+
JSON
.
stringify
(
queryObj
));
const
Canvas
=
cc
.
find
(
"
Canvas
"
);
this
.
callNetworkApiGet
(
`http://staging-teach.ireadabc.com`
,
`/api/oxford/courseware/v1/
${
this
.
courseItem
.
id
}
/getanswer`
,
queryObj
,
(
datastr
)
=>
{
const
middleLayer
=
cc
.
find
(
"
middleLayer
"
);
const
data
=
JSON
.
parse
(
datastr
);
cc
.
find
(
"
middleLayer/ExitBtn
"
).
active
=
true
;
callback
&&
callback
(
JSON
.
stringify
(
data
.
rows
));
this
.
hideWaitingLetters
();
});
this
.
hideMask
();
}
Canvas
.
getComponent
(
cc
.
Widget
).
updateAlignment
();
},
middleLayer
.
scale
=
Canvas
.
width
/
middleLayer
.
width
;
// this.showLog('middleLayer.scale = ' + middleLayer.scale);
callNativeFunction
(
param
)
{
});
const
paramStr
=
JSON
.
stringify
(
param
);
});
if
(
cc
.
sys
.
isNative
&&
cc
.
sys
.
os
==
cc
.
sys
.
OS_IOS
)
{
}
return
jsb
.
reflection
.
callStaticMethod
(
'
CocosMng
'
,
'
cocosWithNativeProtocol:
'
,
paramStr
);
);
}
else
if
(
cc
.
sys
.
isNative
&&
cc
.
sys
.
os
==
cc
.
sys
.
OS_ANDROID
)
{
},
return
jsb
.
reflection
.
callStaticMethod
(
'
com/iplayabc/cocos/AppActivity
'
,
'
cocosWithNativeProtocol
'
,
'
(Ljava/lang/String;)Ljava/lang/String;
'
,
paramStr
);
}
else
if
(
cc
.
sys
.
isNative
&&
cc
.
sys
.
os
==
cc
.
sys
.
OS_WINDOWS
)
{
reloadBundle
()
{
console
.
log
(
'
汪汪汪
'
)
const
{
sceneName
,
version
,
bondleUrl
}
=
this
.
currentBundleInfo
;
}
else
{
console
.
error
(
'
非源生环境
'
);
this
.
loadBundle
(
sceneName
,
version
,
bondleUrl
);
}
},
},
showMask
()
{
const
mask
=
cc
.
find
(
"
middleLayer/mask
"
);
mask
.
active
=
true
;
showWaitingLetters
()
{
cc
.
tween
(
mask
).
set
({
opacity
:
0
}).
to
(
0.5
,
{
opacity
:
0
}).
start
();
},
if
(
this
.
isShowWaiting
)
{
return
;
hideMask
()
{
}
const
mask
=
cc
.
find
(
"
middleLayer/mask
"
);
this
.
isShowWaiting
=
true
;
mask
.
stopAllActions
();
cc
.
tween
(
mask
)
const
layout
=
cc
.
find
(
'
middleLayer/layout
'
);
.
set
({
opacity
:
0
})
layout
.
removeAllChildren
();
.
to
(
0.5
,
{
opacity
:
0
})
.
call
(()
=>
{
const
canvas
=
cc
.
find
(
"
Canvas
"
);
mask
.
active
=
false
;
const
bg
=
layout
.
addComponent
(
cc
.
Graphics
);
})
bg
.
fillRect
(
-
canvas
.
width
/
2
,
-
canvas
.
height
/
2
,
canvas
.
width
,
canvas
.
height
);
.
start
();
},
const
laodingLayer
=
cc
.
find
(
'
middleLayer/loadingLayer
'
);
reWriteAir
()
{
laodingLayer
.
active
=
true
;
window
.
courseware
.
getData
=
(
callback
)
=>
{
const
loading
=
cc
.
find
(
'
middleLayer/loadingLayer/loading
'
);
let
data
=
null
;
const
anim
=
loading
.
getComponent
(
cc
.
Animation
)
if
(
this
.
courseItem
.
data
)
{
anim
.
play
(
'
loading
'
)
data
=
JSON
.
parse
(
this
.
courseItem
.
data
);
}
const
script
=
cc
.
find
(
'
middleLayer/loadingLayer/progress
'
).
getComponent
(
'
progressScript
'
);
this
.
log
(
"
===成功调用getData===
"
+
this
.
courseItem
.
data
);
script
.
setProgress
(
0
);
callback
&&
callback
(
data
);
};
const
id
=
setInterval
(()
=>
{
window
.
courseware
.
nextPage
=
()
=>
{
console
.
log
(
'
changeObj.value:
'
,
changeObj
.
value
);
this
.
goNextPage
();
script
.
setProgress
(
changeObj
.
value
);
};
},
1
);
window
.
courseware
.
beforePage
=
()
=>
{
this
.
goPrePage
();
const
changeObj
=
{
value
:
0
};
};
cc
.
tween
(
changeObj
)
window
.
courseware
.
sendAnswer
=
(
answerObj
)
=>
{
.
to
(
5
,
{
value
:
0.9
})
this
.
log
(
"
===成功调用sendAnswer===
"
+
JSON
.
stringify
(
answerObj
));
.
call
(()
=>
{
this
.
callNetworkApiPost
(
clearInterval
(
id
);
`http://staging-teach.ireadabc.com`
,
})
`/api/oxford/courseware/v1/
${
this
.
courseItem
.
id
}
/saveanswer`
,
.
start
();
answerObj
,
(
data
)
=>
{
answerObj
.
callback
&&
answerObj
.
callback
(
JSON
.
stringify
(
data
.
row
));
}
// const colorList = this.getRainbowColorList();
);
// const layout = cc.find('middleLayer/layout');
};
// layout.removeAllChildren();
window
.
courseware
.
getAnswer
=
(
queryObj
,
callback
)
=>
{
// layout.active = true;
this
.
log
(
"
===成功调用getAnswer===
"
+
JSON
.
stringify
(
queryObj
));
// const str = 'Now Loading...';
this
.
callNetworkApiGet
(
// str.split('').forEach((word, idx) => {
`http://staging-teach.ireadabc.com`
,
// const node = new cc.Node();
`/api/oxford/courseware/v1/
${
this
.
courseItem
.
id
}
/getanswer`
,
// const label = node.addComponent(cc.Label);
queryObj
,
// label.string = word;
(
datastr
)
=>
{
// node.parent = layout;
const
data
=
JSON
.
parse
(
datastr
);
// node.color = colorList[idx];
callback
&&
callback
(
JSON
.
stringify
(
data
.
rows
));
// cc.tween(node)
}
// .delay(idx / 4)
);
// .by(0.3, { y: 50 }, { easing: 'sineOut' })
};
// .by(0.3, { y: -50 }, { easing: 'sineIn' })
},
// .delay((str.length - idx) / 4)
// .union()
callNativeFunction
(
param
)
{
// .repeatForever()
const
paramStr
=
JSON
.
stringify
(
param
);
// .start();
if
(
cc
.
sys
.
isNative
&&
cc
.
sys
.
os
==
cc
.
sys
.
OS_IOS
)
{
// });
return
jsb
.
reflection
.
callStaticMethod
(
// const totalWidth = layout.children.reduce((width, node, idx) => {
"
CocosMng
"
,
// return width + node.width;
"
cocosWithNativeProtocol:
"
,
// }, 0);
paramStr
// layout.width = totalWidth;
);
}
else
if
(
cc
.
sys
.
isNative
&&
cc
.
sys
.
os
==
cc
.
sys
.
OS_ANDROID
)
{
},
return
jsb
.
reflection
.
callStaticMethod
(
"
com/iplayabc/cocos/AppActivity
"
,
hideWaitingLetters
()
{
"
cocosWithNativeProtocol
"
,
"
(Ljava/lang/String;)Ljava/lang/String;
"
,
const
layout
=
cc
.
find
(
'
middleLayer/layout
'
);
paramStr
layout
.
active
=
false
;
);
}
else
if
(
cc
.
sys
.
isNative
&&
cc
.
sys
.
os
==
cc
.
sys
.
OS_WINDOWS
)
{
const
laodingLayer
=
cc
.
find
(
'
middleLayer/loadingLayer
'
);
console
.
log
(
"
汪汪汪
"
);
laodingLayer
.
active
=
false
;
}
else
{
},
console
.
error
(
"
非源生环境
"
);
}
showLog
(
str
)
{
},
if
(
!
this
.
logList
)
{
this
.
logList
=
[];
showWaitingLetters
()
{
}
if
(
this
.
isShowWaiting
)
{
this
.
logList
.
push
(
str
);
return
;
console
.
log
(
str
);
}
this
.
isShowWaiting
=
true
;
if
(
this
.
logList
.
length
==
1
)
{
this
.
showOneLog
();
const
layout
=
cc
.
find
(
"
middleLayer/layout
"
);
}
layout
.
removeAllChildren
();
},
const
canvas
=
cc
.
find
(
"
Canvas
"
);
showDebugUI
()
{
const
bg
=
layout
.
addComponent
(
cc
.
Graphics
);
cc
.
find
(
'
middleLayer/ConsoleNode/BtnOpen
'
).
active
=
true
;
bg
.
fillRect
(
},
-
canvas
.
width
/
2
,
-
canvas
.
height
/
2
,
showOneLog
()
{
canvas
.
width
,
const
str
=
this
.
logList
[
0
];
canvas
.
height
if
(
str
===
undefined
)
{
);
return
;
}
const
laodingLayer
=
cc
.
find
(
"
middleLayer/loadingLayer
"
);
const
node
=
new
cc
.
Node
();
laodingLayer
.
active
=
true
;
node
.
anchorX
=
0.5
;
const
loading
=
cc
.
find
(
"
middleLayer/loadingLayer/loading
"
);
const
label
=
node
.
addComponent
(
cc
.
RichText
);
const
anim
=
loading
.
getComponent
(
cc
.
Animation
);
label
.
string
=
`<outline color=black width=3>
${
str
}
</outline>`
;
anim
.
play
(
"
loading
"
);
label
.
maxWidth
=
this
.
node
.
width
/
2
;
node
.
x
=
this
.
node
.
width
/
4
;
const
script
=
cc
node
.
y
=
-
this
.
node
.
height
/
2
;
.
find
(
"
middleLayer/loadingLayer/progress
"
)
node
.
parent
=
this
.
node
;
.
getComponent
(
"
progressScript
"
);
cc
.
tween
(
node
)
script
.
setProgress
(
0
);
.
to
(
5
,
{
y
:
this
.
node
.
height
})
.
removeSelf
()
const
id
=
setInterval
(()
=>
{
.
start
();
console
.
log
(
"
changeObj.value:
"
,
changeObj
.
value
);
setTimeout
(()
=>
{
script
.
setProgress
(
changeObj
.
value
);
this
.
logList
.
shift
();
},
1
);
this
.
showOneLog
();
},
1000
);
const
changeObj
=
{
value
:
0
};
},
cc
.
tween
(
changeObj
)
.
to
(
5
,
{
value
:
0.9
})
exit
()
{
.
call
(()
=>
{
cc
.
game
.
removePersistRootNode
(
this
.
node
);
clearInterval
(
id
);
cc
.
director
.
loadScene
(
"
emptyScene
"
,
()
=>
{
})
this
.
callNativeFunction
({
name
:
'
exit
'
,
value
:
''
});
.
start
();
});
},
// const colorList = this.getRainbowColorList();
// const layout = cc.find('middleLayer/layout');
getRainbowColorList
()
{
// layout.removeAllChildren();
return
[
// layout.active = true;
cc
.
color
(
255
,
255
,
0
),
// const str = 'Now Loading...';
cc
.
color
(
128
,
255
,
0
),
// str.split('').forEach((word, idx) => {
cc
.
color
(
0
,
255
,
0
),
// const node = new cc.Node();
cc
.
color
(
0
,
0
,
0
),
// const label = node.addComponent(cc.Label);
// label.string = word;
cc
.
color
(
0
,
255
,
128
),
// node.parent = layout;
cc
.
color
(
0
,
255
,
255
),
// node.color = colorList[idx];
// cc.tween(node)
cc
.
color
(
0
,
128
,
255
),
// .delay(idx / 4)
cc
.
color
(
0
,
0
,
255
),
// .by(0.3, { y: 50 }, { easing: 'sineOut' })
cc
.
color
(
128
,
0
,
255
),
// .by(0.3, { y: -50 }, { easing: 'sineIn' })
cc
.
color
(
255
,
0
,
255
),
// .delay((str.length - idx) / 4)
cc
.
color
(
255
,
0
,
128
),
// .union()
// .repeatForever()
cc
.
color
(
255
,
0
,
0
),
// .start();
cc
.
color
(
255
,
128
,
0
),
// });
cc
.
color
(
255
,
255
,
0
),
// const totalWidth = layout.children.reduce((width, node, idx) => {
];
// return width + node.width;
}
// }, 0);
// layout.width = totalWidth;
},
hideWaitingLetters
()
{
const
layout
=
cc
.
find
(
"
middleLayer/layout
"
);
layout
.
active
=
false
;
const
laodingLayer
=
cc
.
find
(
"
middleLayer/loadingLayer
"
);
laodingLayer
.
active
=
false
;
},
showLog
(
str
)
{
if
(
!
this
.
logList
)
{
this
.
logList
=
[];
}
this
.
logList
.
push
(
str
);
console
.
log
(
str
);
if
(
this
.
logList
.
length
==
1
)
{
this
.
showOneLog
();
}
},
showDebugUI
()
{
cc
.
find
(
"
middleLayer/ConsoleNode/BtnOpen
"
).
active
=
true
;
},
showOneLog
()
{
const
str
=
this
.
logList
[
0
];
if
(
str
===
undefined
)
{
return
;
}
const
node
=
new
cc
.
Node
();
node
.
anchorX
=
0.5
;
const
label
=
node
.
addComponent
(
cc
.
RichText
);
label
.
string
=
`<outline color=black width=3>
${
str
}
</outline>`
;
label
.
maxWidth
=
this
.
node
.
width
/
2
;
node
.
x
=
this
.
node
.
width
/
4
;
node
.
y
=
-
this
.
node
.
height
/
2
;
node
.
parent
=
this
.
node
;
cc
.
tween
(
node
).
to
(
5
,
{
y
:
this
.
node
.
height
}).
removeSelf
().
start
();
setTimeout
(()
=>
{
this
.
logList
.
shift
();
this
.
showOneLog
();
},
1000
);
},
exit
()
{
cc
.
game
.
removePersistRootNode
(
this
.
node
);
cc
.
director
.
loadScene
(
"
emptyScene
"
,
()
=>
{
this
.
callNativeFunction
({
name
:
"
exit
"
,
value
:
""
});
});
},
getRainbowColorList
()
{
return
[
cc
.
color
(
255
,
255
,
0
),
cc
.
color
(
128
,
255
,
0
),
cc
.
color
(
0
,
255
,
0
),
cc
.
color
(
0
,
0
,
0
),
cc
.
color
(
0
,
255
,
128
),
cc
.
color
(
0
,
255
,
255
),
cc
.
color
(
0
,
128
,
255
),
cc
.
color
(
0
,
0
,
255
),
cc
.
color
(
128
,
0
,
255
),
cc
.
color
(
255
,
0
,
255
),
cc
.
color
(
255
,
0
,
128
),
cc
.
color
(
255
,
0
,
0
),
cc
.
color
(
255
,
128
,
0
),
cc
.
color
(
255
,
255
,
0
),
];
},
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment