Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
middleLayer_for_NJ_lite
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_NJ_lite
Commits
bcfbf337
Commit
bcfbf337
authored
Sep 27, 2022
by
limingzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: debug 内存溢出
parent
de075337
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
109 additions
and
16 deletions
+109
-16
middleLayer.ts
assets/middleLayer_for_NJ_lite/script/middleLayer.ts
+16
-0
middleLayerBase.ts
assets/middleLayer_for_NJ_lite/script/middleLayerBase.ts
+93
-16
No files found.
assets/middleLayer_for_NJ_lite/script/middleLayer.ts
View file @
bcfbf337
...
@@ -398,6 +398,7 @@ export default class NewClass extends middleLayerBase {
...
@@ -398,6 +398,7 @@ export default class NewClass extends middleLayerBase {
// 重写loadOnlineBundle方法;主要是对一些必要的页面跳转做一些拦截处理
// 重写loadOnlineBundle方法;主要是对一些必要的页面跳转做一些拦截处理
loadOnlineBundle
(
bundleName
,
callback
=
null
)
{
loadOnlineBundle
(
bundleName
,
callback
=
null
)
{
console
.
log
(
"
in loadOnlineBundle
"
)
cc
.
find
(
'
middleLayer/BtnRight
'
).
active
=
false
;
cc
.
find
(
'
middleLayer/BtnRight
'
).
active
=
false
;
cc
.
find
(
'
middleLayer/BtnLeft
'
).
active
=
false
;
cc
.
find
(
'
middleLayer/BtnLeft
'
).
active
=
false
;
cc
.
find
(
'
middleLayer/ExitBtn
'
).
active
=
false
;
cc
.
find
(
'
middleLayer/ExitBtn
'
).
active
=
false
;
...
@@ -617,11 +618,17 @@ export default class NewClass extends middleLayerBase {
...
@@ -617,11 +618,17 @@ export default class NewClass extends middleLayerBase {
const
syllabusPath
=
this
.
getData
(
"
syllabus_path
"
);
const
syllabusPath
=
this
.
getData
(
"
syllabus_path
"
);
console
.
log
(
"
[middleLayer_for_NJ_lite] onClickExitBtn syllabusPath=
"
,
JSON
.
stringify
(
syllabusPath
))
console
.
log
(
"
[middleLayer_for_NJ_lite] onClickExitBtn syllabusPath=
"
,
JSON
.
stringify
(
syllabusPath
))
if
(
!
syllabusPath
)
{
if
(
!
syllabusPath
)
{
console
.
log
(
'
xxxx 1
'
)
this
.
loadOnlineBundle
(
'
NJ_YouLeChang
'
);
this
.
loadOnlineBundle
(
'
NJ_YouLeChang
'
);
return
;
return
;
}
}
if
(
syllabusPath
.
type
===
"
pdtd
"
){
if
(
syllabusPath
.
type
===
"
pdtd
"
){
console
.
log
(
'
xxxx 2
'
)
if
(
syllabusPath
.
pdtd_type
==
'
game_select
'
)
{
if
(
syllabusPath
.
pdtd_type
==
'
game_select
'
)
{
console
.
log
(
'
xxxx 3
'
)
this
.
setData
(
"
NJ_game_select
"
,
{
this
.
setData
(
"
NJ_game_select
"
,
{
step
:
0
,
step
:
0
,
currentPartIdx
:
0
currentPartIdx
:
0
...
@@ -635,16 +642,25 @@ export default class NewClass extends middleLayerBase {
...
@@ -635,16 +642,25 @@ export default class NewClass extends middleLayerBase {
this
.
loadOnlineBundle
(
'
NJ_NongChang
'
);
this
.
loadOnlineBundle
(
'
NJ_NongChang
'
);
}
}
}
else
{
}
else
{
console
.
log
(
'
xxxx 4
'
)
this
.
loadOnlineBundle
(
'
NJ_MoreGames_CourseList
'
);
this
.
loadOnlineBundle
(
'
NJ_MoreGames_CourseList
'
);
}
}
}
else
if
(
syllabusPath
.
type
===
"
ydjyz
"
)
{
}
else
if
(
syllabusPath
.
type
===
"
ydjyz
"
)
{
console
.
log
(
'
xxxx 5
'
)
if
(
this
.
courseItem
.
template_name
==
"
NJ_BookTable
"
)
{
if
(
this
.
courseItem
.
template_name
==
"
NJ_BookTable
"
)
{
console
.
log
(
'
xxxx 6
'
)
this
.
loadOnlineBundle
(
'
NJ_YueDuJiaYouZhan
'
);
this
.
loadOnlineBundle
(
'
NJ_YueDuJiaYouZhan
'
);
}
else
{
}
else
{
const
bookTable
=
this
.
getData
(
"
NJ_BookTable
"
);
const
bookTable
=
this
.
getData
(
"
NJ_BookTable
"
);
this
.
loadOnlineCourseWare
(
bookTable
.
courseId
);
this
.
loadOnlineCourseWare
(
bookTable
.
courseId
);
}
}
}
else
if
(
syllabusPath
.
type
===
"
qwqd
"
)
{
}
else
if
(
syllabusPath
.
type
===
"
qwqd
"
)
{
console
.
log
(
'
xxxx 8
'
)
this
.
loadOnlineBundle
(
'
NJ_MonkyTree
'
);
this
.
loadOnlineBundle
(
'
NJ_MonkyTree
'
);
}
}
}
}
...
...
assets/middleLayer_for_NJ_lite/script/middleLayerBase.ts
View file @
bcfbf337
...
@@ -123,6 +123,7 @@ export abstract class middleLayerBase extends cc.Component {
...
@@ -123,6 +123,7 @@ export abstract class middleLayerBase extends cc.Component {
}
}
loadOnlineBundle
(
bundleName
,
callback
=
null
)
{
loadOnlineBundle
(
bundleName
,
callback
=
null
)
{
console
.
log
(
'
in loadOnlineBundle
'
)
cc
.
find
(
'
middleLayer/BtnRight
'
).
active
=
false
;
cc
.
find
(
'
middleLayer/BtnRight
'
).
active
=
false
;
cc
.
find
(
'
middleLayer/BtnLeft
'
).
active
=
false
;
cc
.
find
(
'
middleLayer/BtnLeft
'
).
active
=
false
;
cc
.
find
(
'
middleLayer/ExitBtn
'
).
active
=
false
;
cc
.
find
(
'
middleLayer/ExitBtn
'
).
active
=
false
;
...
@@ -172,6 +173,7 @@ export abstract class middleLayerBase extends cc.Component {
...
@@ -172,6 +173,7 @@ export abstract class middleLayerBase extends cc.Component {
}
}
reloadBundle
()
{
reloadBundle
()
{
console
.
log
(
'
in reloadBundle
'
);
const
{
sceneName
,
version
,
bondleUrl
}
=
this
.
currentBundleInfo
;
const
{
sceneName
,
version
,
bondleUrl
}
=
this
.
currentBundleInfo
;
this
.
loadBundle
(
sceneName
,
version
,
bondleUrl
);
this
.
loadBundle
(
sceneName
,
version
,
bondleUrl
);
}
}
...
@@ -184,6 +186,7 @@ export abstract class middleLayerBase extends cc.Component {
...
@@ -184,6 +186,7 @@ export abstract class middleLayerBase extends cc.Component {
this
.
assetList
=
[];
this
.
assetList
=
[];
this
.
textureList
=
[];
this
.
textureList
=
[];
this
.
assetObj
=
{};
this
.
atlasList
=
[];
this
.
atlasList
=
[];
this
.
nodeList
=
[];
this
.
nodeList
=
[];
console
.
log
(
'
汪汪汪: getDragonDisplayAssetList
'
);
console
.
log
(
'
汪汪汪: getDragonDisplayAssetList
'
);
...
@@ -193,19 +196,19 @@ export abstract class middleLayerBase extends cc.Component {
...
@@ -193,19 +196,19 @@ export abstract class middleLayerBase extends cc.Component {
console
.
log
(
'
喵喵喵3:
'
+
this
.
assetList
.
length
);
console
.
log
(
'
喵喵喵3:
'
+
this
.
assetList
.
length
);
console
.
log
(
'
喵喵喵4:
'
+
this
.
textureList
.
length
);
console
.
log
(
'
喵喵喵4:
'
+
this
.
textureList
.
length
);
// this.clearDragonDisplayAssetList2();
this
.
loadBundleLock
=
true
;
// 加锁
this
.
loadBundleLock
=
true
;
// 加锁
this
.
currentBundleInfo
=
{
sceneName
,
version
,
bondleUrl
};
this
.
currentBundleInfo
=
{
sceneName
,
version
,
bondleUrl
};
console
.
log
(
"
[middleLayer_for_NJ_lite]-[loadBundle] currentBundleInfo=
"
,
JSON
.
stringify
(
this
.
currentBundleInfo
))
console
.
log
(
"
[middleLayer_for_NJ_lite]-[loadBundle] currentBundleInfo=
"
,
JSON
.
stringify
(
this
.
currentBundleInfo
))
this
.
showWaitingLetters
();
this
.
showWaitingLetters
();
cc
.
audioEngine
.
stopAll
();
cc
.
audioEngine
.
stopAll
();
const
oldSceneName
=
this
.
currentBundleInfo
?.
sceneName
;
//
const oldSceneName = this.currentBundleInfo?.sceneName;
const
engineInfo
=
await
this
.
getEngineInfo
();
//
const engineInfo = await this.getEngineInfo();
const
{
isChanged
}
=
JSON
.
parse
(
engineInfo
);
//
const { isChanged } = JSON.parse(engineInfo);
if
(
isChanged
)
{
//
if (isChanged) {
await
this
.
checkRotateScreen
(
oldSceneName
,
sceneName
);
//
await this.checkRotateScreen(oldSceneName, sceneName);
}
//
}
cc
.
assetManager
.
loadBundle
(
bondleUrl
,
{
version
:
version
},
async
(
err
,
bundle
)
=>
{
cc
.
assetManager
.
loadBundle
(
bondleUrl
,
{
version
:
version
},
async
(
err
,
bundle
)
=>
{
bundle
.
loadScene
(
sceneName
,
null
,
null
,
(
err
,
scene
)
=>
{
bundle
.
loadScene
(
sceneName
,
null
,
null
,
(
err
,
scene
)
=>
{
...
@@ -230,10 +233,11 @@ export abstract class middleLayerBase extends cc.Component {
...
@@ -230,10 +233,11 @@ export abstract class middleLayerBase extends cc.Component {
const
destroyer
=
cc
.
instantiate
(
cc
.
find
(
'
middleLayer/Destroyer
'
));
const
destroyer
=
cc
.
instantiate
(
cc
.
find
(
'
middleLayer/Destroyer
'
));
if
(
destroyer
)
{
//
if (destroyer) {
destroyer
.
parent
=
cc
.
find
(
'
Canvas
'
);
destroyer
.
parent
=
cc
.
find
(
'
Canvas
'
);
destroyer
.
active
=
true
;
destroyer
.
active
=
true
;
}
// }
callback
&&
callback
();
callback
&&
callback
();
...
@@ -328,6 +332,7 @@ export abstract class middleLayerBase extends cc.Component {
...
@@ -328,6 +332,7 @@ export abstract class middleLayerBase extends cc.Component {
}
}
loadPageBundle
(
callback
=
null
)
{
loadPageBundle
(
callback
=
null
)
{
console
.
log
(
"
in loadPageBundle
"
);
let
sceneName
,
version
,
bondleUrl
=
""
;
let
sceneName
,
version
,
bondleUrl
=
""
;
const
templateBaseUrl
=
`
${
this
.
DOMAIN
}
h5template/
${
this
.
courseItem
.
template_name
}
/v
${
this
.
courseItem
.
last_version
}
`
;
const
templateBaseUrl
=
`
${
this
.
DOMAIN
}
h5template/
${
this
.
courseItem
.
template_name
}
/v
${
this
.
courseItem
.
last_version
}
`
;
this
.
getConfigInfo
(
templateBaseUrl
,
(
conf
)
=>
{
this
.
getConfigInfo
(
templateBaseUrl
,
(
conf
)
=>
{
...
@@ -412,13 +417,75 @@ export abstract class middleLayerBase extends cc.Component {
...
@@ -412,13 +417,75 @@ export abstract class middleLayerBase extends cc.Component {
clearDragonDisplayAssetList
()
{
clearDragonDisplayAssetList
()
{
console
.
log
(
'
喵喵喵: clearDragonDisplayAssetList
'
);
console
.
log
(
'
喵喵喵: clearDragonDisplayAssetList
'
);
console
.
log
(
'
喵喵喵:
'
+
this
.
nodeList
.
length
);
console
.
log
(
'
喵喵喵:
'
+
this
.
nodeList
.
length
);
console
.
log
(
'
喵喵喵:
'
+
this
.
atlasList
.
length
);
console
.
log
(
'
喵喵喵:
'
+
this
.
atlasList
.
length
);
console
.
log
(
'
喵喵喵:
'
+
this
.
assetList
.
length
);
console
.
log
(
'
喵喵喵:
'
+
this
.
assetList
.
length
);
console
.
log
(
'
喵喵喵:
'
+
this
.
textureList
.
length
);
console
.
log
(
'
喵喵喵:
'
+
this
.
textureList
.
length
);
[...
this
.
atlasList
,
...
this
.
assetList
].
forEach
(
asset
=>
{
if
(
this
.
atlasList
.
length
==
0
)
{
return
;
}
// this.atlasList[3] = this.atlasList[7];
// this.assetList[3] = this.assetList[7];
// this.nodeList[3] = this.nodeList[7];
// this.textureList[3] = this.textureList[7];
// this.atlasList.length = this.assetList.length = this.nodeList.length = this.textureList.length = 1;
[
...
this
.
atlasList
,
...
this
.
assetList
].
forEach
(
asset
=>
{
console
.
log
(
'
asset_uuid:
'
,
asset
.
_uuid
);
console
.
log
(
'
asset:
'
,
asset
);
while
(
asset
?.
refCount
>
0
)
{
asset
.
decRef
();
}
// cc.assetManager.releaseAsset(asset);
// asset.destroy();
});
this
.
nodeList
.
forEach
(
node
=>
{
node
.
active
=
false
;
node
.
removeFromParent
();
});
this
.
textureList
.
forEach
(
texture
=>
{
console
.
log
(
'
texture_uuid:
'
,
texture
.
_uuid
);
console
.
log
(
'
texture:
'
,
texture
);
while
(
texture
?.
refCount
>
0
)
{
texture
.
decRef
();
}
});
this
.
atlasList
.
length
=
this
.
assetList
.
length
=
this
.
nodeList
.
length
=
this
.
textureList
.
length
=
1
;
[
...
this
.
atlasList
,
...
this
.
assetList
].
forEach
(
asset
=>
{
console
.
log
(
'
asset_uuid:
'
,
asset
.
_uuid
);
console
.
log
(
'
asset:
'
,
asset
);
// asset.decRef();
cc
.
assetManager
.
releaseAsset
(
asset
);
// asset.destroy();
});
}
clearDragonDisplayAssetList2
()
{
console
.
log
(
'
喵喵喵: clearDragonDisplayAssetList
'
);
console
.
log
(
'
喵喵喵:
'
+
this
.
nodeList
.
length
);
console
.
log
(
'
喵喵喵:
'
+
this
.
atlasList
.
length
);
console
.
log
(
'
喵喵喵:
'
+
this
.
assetList
.
length
);
console
.
log
(
'
喵喵喵:
'
+
this
.
textureList
.
length
);
[
...
this
.
atlasList
,
...
this
.
assetList
].
forEach
(
asset
=>
{
asset
.
decRef
();
asset
.
decRef
();
cc
.
assetManager
.
releaseAsset
(
asset
);
cc
.
assetManager
.
releaseAsset
(
asset
);
asset
.
destroy
();
asset
.
destroy
();
...
@@ -432,8 +499,10 @@ export abstract class middleLayerBase extends cc.Component {
...
@@ -432,8 +499,10 @@ export abstract class middleLayerBase extends cc.Component {
this
.
textureList
.
forEach
(
texture
=>
{
this
.
textureList
.
forEach
(
texture
=>
{
texture
.
decRef
();
texture
.
decRef
();
});
});
}
}
assetObj
=
null
;
nodeList
=
null
;
nodeList
=
null
;
atlasList
=
null
;
atlasList
=
null
;
assetList
=
null
;
assetList
=
null
;
...
@@ -452,11 +521,19 @@ export abstract class middleLayerBase extends cc.Component {
...
@@ -452,11 +521,19 @@ export abstract class middleLayerBase extends cc.Component {
return
;
return
;
}
}
// const uuid = asset._uuid;
// if (!this.assetObj[uuid]) {
this
.
nodeList
.
push
(
node
);
this
.
nodeList
.
push
(
node
);
this
.
atlasList
.
push
(
atlas
);
this
.
atlasList
.
push
(
atlas
);
this
.
assetList
.
push
(
asset
);
this
.
assetList
.
push
(
asset
);
this
.
textureList
.
push
(
atlas
.
texture
);
this
.
textureList
.
push
(
atlas
.
texture
);
// this.assetObj[uuid] = true;
console
.
log
(
'
汪汪汪: atlas.texture.nativeUrl =
'
+
atlas
.
texture
.
nativeUrl
);
console
.
log
(
'
汪汪汪: atlas.texture.nativeUrl =
'
+
atlas
.
texture
.
nativeUrl
);
// }
}
}
}
}
...
...
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