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
d95264a1
Commit
d95264a1
authored
Dec 05, 2021
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debug
parent
42eb59e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
31 deletions
+37
-31
middleLayer.js
assets/middleLayer_for_debug/script/middleLayer.js
+37
-31
No files found.
assets/middleLayer_for_debug/script/middleLayer.js
View file @
d95264a1
...
@@ -51,10 +51,7 @@ cc.Class({
...
@@ -51,10 +51,7 @@ cc.Class({
// if (!window.preloadBundleAndSourcesFlag) {
// if (!window.preloadBundleAndSourcesFlag) {
// // 只加载一次就行了
// // 只加载一次就行了
// window.preloadBundleAndSourcesFlag = true;
// window.preloadBundleAndSourcesFlag = true;
// cc.find("middleLayer/ui/ProgressLabel").active = true;
// cc.find('middleLayer/ui/loadingProgress').active = true;
// this.preloadBundle();
// this.preloadSource();
// }
// }
},
},
...
@@ -87,7 +84,7 @@ cc.Class({
...
@@ -87,7 +84,7 @@ cc.Class({
middleLayer
.
log
(
"
middleLayer.log('像这样在这里打log')
"
);
middleLayer
.
log
(
"
middleLayer.log('像这样在这里打log')
"
);
},
},
preload
Bundle
()
{
preload
All
()
{
let
platform
=
"
web_desktop
"
;
let
platform
=
"
web_desktop
"
;
if
(
cc
.
sys
.
os
==
cc
.
sys
.
OS_IOS
)
{
if
(
cc
.
sys
.
os
==
cc
.
sys
.
OS_IOS
)
{
platform
=
"
ios
"
;
platform
=
"
ios
"
;
...
@@ -98,18 +95,26 @@ cc.Class({
...
@@ -98,18 +95,26 @@ cc.Class({
const
data
=
JSON
.
parse
(
datastr
);
const
data
=
JSON
.
parse
(
datastr
);
if
(
data
.
rows
&&
data
.
rows
.
length
>
0
)
{
if
(
data
.
rows
&&
data
.
rows
.
length
>
0
)
{
this
.
preloadCount
+=
data
.
rows
.
length
;
this
.
preloadCount
+=
data
.
rows
.
length
;
this
.
batchPreloadScene
(
data
.
rows
);
}
}
this
.
callNetworkApiGet
(
`http://staging-teach.ireadabc.com`
,
`/api/syllabus/v1/allresources`
,
{
orgid
:
507
},
(
datastr1
)
=>
{
const
data1
=
JSON
.
parse
(
datastr1
);
if
(
data1
.
rows
&&
data1
.
rows
.
length
>
0
)
{
this
.
preloadCount
+=
data1
.
rows
.
length
;
}
this
.
batchPreloadScene
(
data
.
rows
);
this
.
preloadSource
(
data1
.
rows
);
});
});
});
},
},
batchPreloadScene
(
scenes
)
{
batchPreloadScene
(
scenes
=
[])
{
const
expects
=
[
const
expects
=
[
// 'op_09', 'OP05',
// 'op_09', 'OP05',
// 'OP_03', 'op_01',
// 'OP_03', 'op_01',
// 'LWD_3', 'op_07',
// 'LWD_3', 'op_07',
// 'op_02', 'OP_08',
// 'op_02', 'OP_08',
// 'op_06_1', 'OP10',
// 'op_06_1', 'OP10',
'
op_09_plus
'
,
//
'op_09_plus',
'
OP11
'
,
'
OP11
'
,
'
OP10_online
'
,
'
OP12
'
,
'
OP10_online
'
,
'
OP12
'
,
'
OP13
'
,
'
OP_03_1
'
,
'
OP13
'
,
'
OP_03_1
'
,
...
@@ -153,31 +158,25 @@ cc.Class({
...
@@ -153,31 +158,25 @@ cc.Class({
}
}
},
},
preloadSource
()
{
preloadSource
(
array
)
{
this
.
callNetworkApiGet
(
`http://staging-teach.ireadabc.com`
,
`/api/syllabus/v1/allresources`
,
{
orgid
:
507
},
(
datastr
)
=>
{
const
rows
=
array
||
[];
const
data
=
JSON
.
parse
(
datastr
);
const
batchLoad
=
()
=>
{
const
rows
=
data
.
rows
;
let
tempArr
=
rows
.
splice
(
0
,
10
);
if
(
rows
&&
rows
.
length
>
0
)
{
let
len
=
tempArr
.
length
;
this
.
preloadCount
+=
rows
.
length
;
for
(
let
i
=
0
;
i
<
tempArr
.
length
;
i
++
)
{
const
batchLoad
=
()
=>
{
cc
.
assetManager
.
loadRemote
(
tempArr
[
i
],
(
err
,
texture
)
=>
{
let
tempArr
=
rows
.
splice
(
0
,
10
);
if
(
err
)
{
let
len
=
tempArr
.
length
;
console
.
log
(
err
)
for
(
let
i
=
0
;
i
<
tempArr
.
length
;
i
++
)
{
cc
.
assetManager
.
loadRemote
(
tempArr
[
i
],
(
err
,
texture
)
=>
{
if
(
err
)
{
console
.
log
(
err
)
}
this
.
loadedCount
++
;
this
.
updateProcessBar
();
if
(
i
===
len
-
1
)
{
batchLoad
();
}
});
}
}
}
this
.
loadedCount
++
;
batchLoad
();
this
.
updateProcessBar
();
if
(
i
===
len
-
1
)
{
batchLoad
();
}
});
}
}
});
}
batchLoad
();
},
},
updateProcessBar
()
{
updateProcessBar
()
{
...
@@ -266,6 +265,13 @@ cc.Class({
...
@@ -266,6 +265,13 @@ cc.Class({
this
.
loadOnlineCourseWare
(
courseId
);
this
.
loadOnlineCourseWare
(
courseId
);
});
});
const
BtnLoad
=
cc
.
find
(
'
middleLayer/ui/BtnLoad
'
);
BtnLoad
.
on
(
'
click
'
,
()
=>
{
cc
.
find
(
"
middleLayer/ui/ProgressLabel
"
).
active
=
true
;
cc
.
find
(
'
middleLayer/ui/loadingProgress
'
).
active
=
true
;
this
.
preloadAll
();
});
const
btnClose
=
cc
.
find
(
'
middleLayer/ConsoleNode/BtnClose
'
);
const
btnClose
=
cc
.
find
(
'
middleLayer/ConsoleNode/BtnClose
'
);
const
btnOpen
=
cc
.
find
(
'
middleLayer/ConsoleNode/BtnOpen
'
);
const
btnOpen
=
cc
.
find
(
'
middleLayer/ConsoleNode/BtnOpen
'
);
const
consoleNode
=
cc
.
find
(
'
middleLayer/ConsoleNode/Console
'
);
const
consoleNode
=
cc
.
find
(
'
middleLayer/ConsoleNode/Console
'
);
...
...
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