Commit 0cfa63ea authored by limingzhe's avatar limingzhe

feat: 清洁骨骼动画

parent 071e9e98
No preview for this file type
......@@ -179,10 +179,7 @@ export abstract class middleLayerBase extends cc.Component {
}
async loadBundle(sceneName, version, bondleUrl, callback = null) {
// if(this.loadBundleLock) {
// this.addToLoadBundleBuffer(sceneName, version, bondleUrl, callback)
// return;
// }
this.assetList = [];
this.textureList = [];
......@@ -206,16 +203,9 @@ export abstract class middleLayerBase extends cc.Component {
console.log("[middleLayer_for_NJ_lite]-[loadBundle] currentBundleInfo=", JSON.stringify(this.currentBundleInfo))
this.showWaitingLetters();
cc.audioEngine.stopAll();
// const oldSceneName = this.currentBundleInfo?.sceneName;
// const engineInfo = await this.getEngineInfo();
// const { isChanged } = JSON.parse(engineInfo);
// if (isChanged) {
// await this.checkRotateScreen(oldSceneName, sceneName);
// }
// this.clearDragonDisplayAssetList();
this.setNodeListVisible();
// await asyncDelay(0.001);
// 手机端强制垃圾回收
if (cc.sys.os == cc.sys.OS_IOS || cc.sys.os == cc.sys.OS_ANDROID) {
......@@ -225,13 +215,7 @@ export abstract class middleLayerBase extends cc.Component {
cc.assetManager.loadBundle(bondleUrl, { version: version }, async (err, bundle) => {
bundle.loadScene(sceneName, null, null, (err, scene) => {
this.loadBundleLock = false; // 加载完成 解锁
// let bufferedLoadBundle = this.getLoadBundleFromBuffer();
// if(bufferedLoadBundle) {
// console.log("[middleLayer_for_NJ_lite]-[loadBundle] load buffered sceneName=", bufferedLoadBundle.sceneName)
// this.loadBundle(bufferedLoadBundle.sceneName, bufferedLoadBundle.version, bufferedLoadBundle.bondleUrl, bufferedLoadBundle.callback)
// callback && callback();
// return;
// }
this.courseOpenTimeStamp = Date.now();
cc.director.runScene(scene, null, () => {
console.log('sceneName = ' + sceneName);
......@@ -243,12 +227,10 @@ export abstract class middleLayerBase extends cc.Component {
canvas.getComponent(cc.Widget).updateAlignment();
middleLayer.scale = canvas.width / middleLayer.width;
// 挂载清洁骨骼机制节点
const destroyer = cc.instantiate(cc.find('middleLayer/Destroyer'));
// if (destroyer) {
destroyer.parent = cc.find('Canvas');
destroyer.active = true;
// }
destroyer.parent = cc.find('Canvas');
destroyer.active = true;
// 手机端强制垃圾回收
......@@ -263,6 +245,19 @@ export abstract class middleLayerBase extends cc.Component {
});
}
setNodeListVisible() {
const setParentVisible = (n) => {
n.active = true;
if (n.parent) {
setParentVisible(n.parent);
}
}
this.nodeList.forEach(node => {
setParentVisible(node);
});
}
getUUID() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = Math.random() * 16 | 0,
......@@ -444,26 +439,8 @@ export abstract class middleLayerBase extends cc.Component {
return;
}
this.setNodeListVisible();
const setParentVisible = (n) => {
n.active = true;
if (n.parent) {
setParentVisible(n.parent);
}
}
this.nodeList.forEach(node => {
setParentVisible(node);
// node.active = false;
// node.removeFromParent();
});
console.log("this.atlasList.length 1: ", this.atlasList.length);
// await asyncDelay(0.001);
console.log("this.atlasList.length: ", this.atlasList.length);
for (let i=0; i<this.atlasList.length; i++) {
......@@ -482,40 +459,15 @@ export abstract class middleLayerBase extends cc.Component {
asset.destroy();
node.active = false;
node.removeFromParent();
// node.active = false;
// node.removeFromParent();
texture.decRef();
console.log('aaaaa~');
// await asyncDelay(0.001);
}
// [ ...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();
// });
}
......@@ -545,34 +497,6 @@ export abstract class middleLayerBase extends cc.Component {
}
clearDragonDisplayAssetList2() {
return;
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);
cc.sys.garbageCollect()
asset.destroy();
});
this.nodeList.forEach(node => {
node.active = false;
node.removeFromParent();
});
this.textureList.forEach(texture => {
texture.decRef();
cc.assetManager.releaseAsset(texture);
cc.sys.garbageCollect()
});
}
assetObj = null;
nodeList = null;
......@@ -594,19 +518,12 @@ export abstract class middleLayerBase extends cc.Component {
return;
}
// const uuid = asset._uuid;
// if (!this.assetObj[uuid]) {
this.nodeList.push(node);
this.atlasList.push(atlas);
this.assetList.push(asset);
this.textureList.push(atlas.texture);
// this.assetObj[uuid] = true;
console.log('汪汪汪: atlas.texture.nativeUrl = ' + atlas.texture.nativeUrl);
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);
}
}
......
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