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
468bfa95
Commit
468bfa95
authored
Sep 26, 2022
by
limingzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 清内存
parent
4b33e0f1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
99 additions
and
0 deletions
+99
-0
Destroyer.js
assets/middleLayer_for_NJ_lite/script/Destroyer.js
+8
-0
Destroyer.js.meta
assets/middleLayer_for_NJ_lite/script/Destroyer.js.meta
+9
-0
middleLayerBase.ts
assets/middleLayer_for_NJ_lite/script/middleLayerBase.ts
+82
-0
No files found.
assets/middleLayer_for_NJ_lite/script/Destroyer.js
0 → 100644
View file @
468bfa95
cc
.
Class
({
extends
:
cc
.
Component
,
onDestroy
()
{
console
.
log
(
'
喵喵喵: destroyer onDestroy
'
);
middleLayer
.
clearDragonDisplayAssetList
();
}
});
assets/middleLayer_for_NJ_lite/script/Destroyer.js.meta
0 → 100644
View file @
468bfa95
{
"ver": "1.0.8",
"uuid": "ddd21bda-bd5e-4e01-938a-e933c777725e",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
assets/middleLayer_for_NJ_lite/script/middleLayerBase.ts
View file @
468bfa95
...
@@ -181,6 +181,19 @@ export abstract class middleLayerBase extends cc.Component {
...
@@ -181,6 +181,19 @@ export abstract class middleLayerBase extends cc.Component {
this
.
addToLoadBundleBuffer
(
sceneName
,
version
,
bondleUrl
,
callback
)
this
.
addToLoadBundleBuffer
(
sceneName
,
version
,
bondleUrl
,
callback
)
return
;
return
;
}
}
this
.
assetList
=
[];
this
.
textureList
=
[];
this
.
atlasList
=
[];
this
.
nodeList
=
[];
console
.
log
(
'
汪汪汪: getDragonDisplayAssetList
'
);
this
.
getDragonDisplayAssetList
(
cc
.
find
(
'
Canvas
'
));
console
.
log
(
'
喵喵喵1:
'
+
this
.
nodeList
.
length
);
console
.
log
(
'
喵喵喵2:
'
+
this
.
atlasList
.
length
);
console
.
log
(
'
喵喵喵3:
'
+
this
.
assetList
.
length
);
console
.
log
(
'
喵喵喵4:
'
+
this
.
textureList
.
length
);
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
))
...
@@ -214,6 +227,12 @@ export abstract class middleLayerBase extends cc.Component {
...
@@ -214,6 +227,12 @@ export abstract class middleLayerBase extends cc.Component {
canvas
.
getComponent
(
cc
.
Widget
).
updateAlignment
();
canvas
.
getComponent
(
cc
.
Widget
).
updateAlignment
();
middleLayer
.
scale
=
canvas
.
width
/
middleLayer
.
width
;
middleLayer
.
scale
=
canvas
.
width
/
middleLayer
.
width
;
const
destroyer
=
cc
.
instantiate
(
cc
.
find
(
'
middleLayer/Destroyer
'
));
destroyer
.
parent
=
cc
.
find
(
'
Canvas
'
);
destroyer
.
active
=
true
;
callback
&&
callback
();
callback
&&
callback
();
});
});
...
@@ -381,4 +400,67 @@ export abstract class middleLayerBase extends cc.Component {
...
@@ -381,4 +400,67 @@ export abstract class middleLayerBase extends cc.Component {
.
removeSelf
()
.
removeSelf
()
.
start
();
.
start
();
}
}
clearDragonDisplayAssetList
()
{
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
();
cc
.
assetManager
.
releaseAsset
(
asset
);
asset
.
destroy
();
});
this
.
nodeList
.
forEach
(
node
=>
{
node
.
active
=
false
;
node
.
removeFromParent
();
});
this
.
textureList
.
forEach
(
texture
=>
{
texture
.
decRef
();
});
}
nodeList
=
null
;
atlasList
=
null
;
assetList
=
null
;
textureList
=
null
;
getDragonDisplayAssetList
(
node
)
{
const
dragonDisplay
=
node
.
getComponent
(
dragonBones
.
ArmatureDisplay
);
if
(
dragonDisplay
)
{
const
atlas
=
dragonDisplay
.
dragonAtlasAsset
;
const
asset
=
dragonDisplay
.
dragonAsset
;
if
(
atlas
.
texture
)
{
if
(
atlas
.
texture
.
nativeUrl
.
includes
(
'
h5template
'
))
{
node
.
children
.
forEach
(
child
=>
{
this
.
getDragonDisplayAssetList
(
child
);
});
return
;
}
this
.
nodeList
.
push
(
node
);
this
.
atlasList
.
push
(
atlas
);
this
.
assetList
.
push
(
asset
);
this
.
textureList
.
push
(
atlas
.
texture
);
console
.
log
(
'
汪汪汪: atlas.texture.nativeUrl =
'
+
atlas
.
texture
.
nativeUrl
);
}
}
node
.
children
.
forEach
(
child
=>
{
this
.
getDragonDisplayAssetList
(
child
);
});
}
}
}
\ No newline at end of file
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