Commit 21dd9102 authored by limingzhe's avatar limingzhe

fix: 清内存

parent eaaaff71
{"ver":"1.1.2","uuid":"70bc04c3-e5e3-4c70-8f48-a26ea3453ebd","isBundle":false,"bundleName":"","priority":1,"compressionType":{},"optimizeHotUpdate":{},"inlineSpriteFrames":{},"isRemoteBundle":{"ios":false,"android":false},"subMetas":{}}
\ No newline at end of file
{"ver":"1.1.2","uuid":"9885d167-7e00-428c-b5ab-c26cc063e331","isBundle":false,"bundleName":"","priority":1,"compressionType":{},"optimizeHotUpdate":{},"inlineSpriteFrames":{},"isRemoteBundle":{"ios":false,"android":false},"subMetas":{}}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "ffb16d4b-3e4d-411a-9451-d8cb9fd00fa0",
"uuid": "00c27356-4548-4344-94dc-aca3d9c85262",
"isBundle": false,
"bundleName": "",
"priority": 1,
......
{
"ver": "2.0.1",
"uuid": "345a2bb3-6c63-403e-9ca1-24ab794903bc",
"uuid": "699d9bc8-2d7d-4b47-98d1-edcb9d241ede",
"downloadMode": 0,
"duration": 1.1755,
"subMetas": {}
......
{
"ver": "2.0.1",
"uuid": "8216d147-d91c-4528-8781-96f07b6e54a2",
"uuid": "d4105d64-d01c-4e6c-984d-28fb6b4bcb07",
"downloadMode": 0,
"duration": 5.112,
"subMetas": {}
......
{
"ver": "2.0.1",
"uuid": "971c3859-f589-46aa-83d8-aa24632c7243",
"uuid": "00a15000-f199-435b-9bcd-291aa5d1d432",
"downloadMode": 0,
"duration": 4.362449,
"subMetas": {}
......
{
"ver": "2.0.1",
"uuid": "05cf2f75-2b5e-4433-a428-e44d1b302731",
"uuid": "02851aed-506b-4c06-a1cc-d14c11ee735c",
"downloadMode": 0,
"duration": 2.592,
"subMetas": {}
......
{
"ver": "1.1.2",
"uuid": "aec7963b-8cd0-4efa-8d7d-1189d3a86ca7",
"uuid": "8ebb7c56-aa5b-412c-881a-05e951c528d2",
"isBundle": false,
"bundleName": "",
"priority": 1,
......
{
"ver": "1.1.2",
"uuid": "ffac39cb-d042-40fa-9232-6a6af7d106bb",
"uuid": "c23836af-d983-430b-b132-1edd4aeedac0",
"isBundle": false,
"bundleName": "",
"priority": 1,
......
{
"ver": "1.0.1",
"uuid": "712ee0fa-2ebd-4da2-8eb8-8888b26aebe0",
"uuid": "ce33ffb2-0506-4d04-a61f-560a0ff93356",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "05ddf8ee-3027-4539-b908-386e8a4793b6",
"uuid": "a3732e00-fdd7-44fd-95b1-47ef94d35f67",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "ddc0cf9e-be99-4f06-80f0-9ddfeb4c6883",
"uuid": "46e882c6-14a7-4471-9945-985d8e6f5fb3",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
......@@ -13,8 +13,8 @@
"subMetas": {
"徽章动画_tex": {
"ver": "1.0.4",
"uuid": "409538b5-7347-4ffb-9231-5d3e04c1ccb5",
"rawTextureUuid": "ddc0cf9e-be99-4f06-80f0-9ddfeb4c6883",
"uuid": "a646175c-c42b-4989-946a-b93fbe551bb1",
"rawTextureUuid": "46e882c6-14a7-4471-9945-985d8e6f5fb3",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
......
{
"ver": "1.1.2",
"uuid": "a288abbb-cf54-45eb-8425-3149865c1fa1",
"uuid": "f30cee40-2916-4116-ab24-2aa87fc4bcc4",
"isBundle": false,
"bundleName": "",
"priority": 1,
......
{
"ver": "1.0.1",
"uuid": "24e3c132-6f4b-471c-bbbd-ee6b2222b96f",
"uuid": "9b587aa6-b207-40ff-ab30-0e33f8342b78",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "b54daf60-2609-42f6-90ec-1cced6c45a0e",
"uuid": "802057e3-285d-4a90-a658-120020ce6bbb",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "86a6ed96-65f3-4886-87ed-7b09952baba9",
"uuid": "11323465-2322-43f5-a9a3-70732a8d6a3b",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
......@@ -13,8 +13,8 @@
"subMetas": {
"hand_tex": {
"ver": "1.0.4",
"uuid": "56fad7b0-462e-4f2b-99c3-ea246095c2fb",
"rawTextureUuid": "86a6ed96-65f3-4886-87ed-7b09952baba9",
"uuid": "71811c5d-50bb-464e-a1ec-cc94c0535753",
"rawTextureUuid": "11323465-2322-43f5-a9a3-70732a8d6a3b",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
......
{
"ver": "1.1.2",
"uuid": "ed983827-3ad1-4660-995b-e388237b6abd",
"uuid": "fe88c649-558a-426e-ad6f-af0583067035",
"isBundle": false,
"bundleName": "",
"priority": 1,
......
{
"ver": "1.1.0",
"uuid": "673b7859-cec2-4408-93a1-e88a18526074",
"uuid": "6cda5116-82bb-44cb-a57c-abb186367415",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "860496c7-a863-46d7-8a96-cf75e852da23",
"uuid": "f37d95fe-8b38-4052-906e-519fc65323f2",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "df0821bd-02cc-43df-8749-f0a821be960e",
"uuid": "74c317eb-d6eb-494c-80c2-7fc602b18419",
"isBundle": false,
"bundleName": "",
"priority": 1,
......
......@@ -58,7 +58,7 @@
"_groupIndex": 0,
"groupIndex": 0,
"autoReleaseAssets": false,
"_id": "9ef4faa1-84f0-4742-95d2-d2eaf214f37d"
"_id": "4a29e4b1-f8b4-4b6a-b305-7d4b475e23a1"
},
{
"__type__": "cc.Node",
......@@ -320,7 +320,7 @@
"_cacheMode": 0,
"playTimes": -1,
"premultipliedAlpha": false,
"_armatureKey": "24e3c132-6f4b-471c-bbbd-ee6b2222b96f#b54daf60-2609-42f6-90ec-1cced6c45a0e",
"_armatureKey": "9b587aa6-b207-40ff-ab30-0e33f8342b78#802057e3-285d-4a90-a658-120020ce6bbb",
"_accTime": 0,
"_playCount": 0,
"_frameCache": null,
......@@ -328,10 +328,10 @@
"_playing": false,
"_armatureCache": null,
"_N$dragonAsset": {
"__uuid__": "24e3c132-6f4b-471c-bbbd-ee6b2222b96f"
"__uuid__": "9b587aa6-b207-40ff-ab30-0e33f8342b78"
},
"_N$dragonAtlasAsset": {
"__uuid__": "b54daf60-2609-42f6-90ec-1cced6c45a0e"
"__uuid__": "802057e3-285d-4a90-a658-120020ce6bbb"
},
"_N$_defaultArmatureIndex": 0,
"_N$_animationIndex": 1,
......@@ -422,7 +422,7 @@
"_cacheMode": 0,
"playTimes": -1,
"premultipliedAlpha": false,
"_armatureKey": "712ee0fa-2ebd-4da2-8eb8-8888b26aebe0#05ddf8ee-3027-4539-b908-386e8a4793b6",
"_armatureKey": "ce33ffb2-0506-4d04-a61f-560a0ff93356#a3732e00-fdd7-44fd-95b1-47ef94d35f67",
"_accTime": 0,
"_playCount": 0,
"_frameCache": null,
......@@ -430,10 +430,10 @@
"_playing": false,
"_armatureCache": null,
"_N$dragonAsset": {
"__uuid__": "712ee0fa-2ebd-4da2-8eb8-8888b26aebe0"
"__uuid__": "ce33ffb2-0506-4d04-a61f-560a0ff93356"
},
"_N$dragonAtlasAsset": {
"__uuid__": "05ddf8ee-3027-4539-b908-386e8a4793b6"
"__uuid__": "a3732e00-fdd7-44fd-95b1-47ef94d35f67"
},
"_N$_defaultArmatureIndex": 0,
"_N$_animationIndex": 1,
......@@ -655,7 +655,7 @@
"_lineHeight": 40,
"_enableWrapText": true,
"_N$file": {
"__uuid__": "673b7859-cec2-4408-93a1-e88a18526074"
"__uuid__": "6cda5116-82bb-44cb-a57c-abb186367415"
},
"_isSystemFontUsed": false,
"_spacingX": 0,
......@@ -748,7 +748,7 @@
"_lineHeight": 40,
"_enableWrapText": true,
"_N$file": {
"__uuid__": "860496c7-a863-46d7-8a96-cf75e852da23"
"__uuid__": "f37d95fe-8b38-4052-906e-519fc65323f2"
},
"_isSystemFontUsed": false,
"_spacingX": 0,
......@@ -919,7 +919,7 @@
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "21c46819-635d-44f1-8802-24eed947ec47"
"__uuid__": "7970e7a4-3344-4654-869e-7d86525d538f"
},
"_type": 0,
"_sizeMode": 1,
......@@ -1009,7 +1009,7 @@
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "3c775c24-d497-4961-bef3-c07596a41a72"
"__uuid__": "17c172fa-3ad0-4f60-a6b7-a2e8cee68772"
},
"_type": 0,
"_sizeMode": 1,
......@@ -1099,7 +1099,7 @@
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "5da77720-589f-4569-80d9-9b1718a36c81"
"__uuid__": "5b6844fd-84de-4a0b-a953-94fde6c64547"
},
"_type": 0,
"_sizeMode": 1,
......@@ -1189,7 +1189,7 @@
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "5ed3c2b7-e11c-468f-98a4-99264a4377a4"
"__uuid__": "9bc3a9ad-b2e2-4811-b037-148edbc3224e"
},
"_type": 0,
"_sizeMode": 1,
......@@ -1279,7 +1279,7 @@
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "0c4f7341-41d9-4cea-a05d-6777dddb3b86"
"__uuid__": "0a814c8c-7ec2-49fe-84a1-82cb2d97397c"
},
"_type": 0,
"_sizeMode": 1,
......@@ -1369,7 +1369,7 @@
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "236c2bbd-77a1-4f2e-b4c1-7338f549a8d5"
"__uuid__": "c76ff575-367c-4f43-bed2-2673f9bbeb91"
},
"_type": 0,
"_sizeMode": 1,
......@@ -1459,7 +1459,7 @@
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "9231a078-9119-4563-af21-88c1a2720b6b"
"__uuid__": "f9729f00-7d67-4824-808e-db4f2743b2ad"
},
"_type": 0,
"_sizeMode": 1,
......@@ -1549,7 +1549,7 @@
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "f14ac956-031f-41f0-8fb4-4b00647c02f7"
"__uuid__": "7c55e90a-88f6-4947-baa2-b9a67ba52f5d"
},
"_type": 0,
"_sizeMode": 1,
......@@ -1704,7 +1704,7 @@
},
"_enabled": true,
"_clip": {
"__uuid__": "05cf2f75-2b5e-4433-a428-e44d1b302731"
"__uuid__": "02851aed-506b-4c06-a1cc-d14c11ee735c"
},
"_volume": 1,
"_mute": false,
......@@ -1785,7 +1785,7 @@
},
"_enabled": true,
"_clip": {
"__uuid__": "8216d147-d91c-4528-8781-96f07b6e54a2"
"__uuid__": "d4105d64-d01c-4e6c-984d-28fb6b4bcb07"
},
"_volume": 1,
"_mute": false,
......@@ -1866,7 +1866,7 @@
},
"_enabled": true,
"_clip": {
"__uuid__": "971c3859-f589-46aa-83d8-aa24632c7243"
"__uuid__": "00a15000-f199-435b-9bcd-291aa5d1d432"
},
"_volume": 1,
"_mute": false,
......@@ -1921,7 +1921,7 @@
"_id": "29zXboiXFBKoIV4PQ2liTe"
},
{
"__type__": "01bc5whNeBN97RckeHba7w2",
"__type__": "e7337yMRQxG+661GqZYnBz7",
"_name": "",
"_objFlags": 0,
"node": {
......
{
"ver": "1.2.9",
"uuid": "9ef4faa1-84f0-4742-95d2-d2eaf214f37d",
"uuid": "4a29e4b1-f8b4-4b6a-b305-7d4b475e23a1",
"asyncLoadAssets": false,
"autoReleaseAssets": false,
"autoReleaseAssets": true,
"subMetas": {}
}
\ No newline at end of file
import { asyncDelay, asyncLoadDragonBoneAnime, callMiddleLayerFunction, onHomeworkFinish, playAudio } from "../script/util";
import { asyncDelay, callMiddleLayerFunction, onHomeworkFinish, playAudio } from "../script/util";
import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent";
const { ccclass, property } = cc._decorator;
......@@ -13,22 +13,26 @@ export default class SceneComponent extends MyCocosSceneComponent {
addPreloadAudio() {
// TODO 根据自己的配置预加载音频资源
this._audioResList.push({ url: (this.data.lrcData && this.data.lrcData.audio_url) || '' });
this._audioResList.push({ url: (this.data.lrcData && this.data.lrcData.audio_url) || ''});
}
animBaseUrl;
addPreloadAnima() {
console.log('this.data: ' + JSON.stringify(this.data));
if (this.data?.skeJsonData?.url) {
this.animBaseUrl = this.data.skeJsonData.ur;
console.log('this.animBaseUrl: ' + this.animBaseUrl );
this.data.skeJsonData.url += '?time=' + new Date().getTime()
this.data.texJsonData.url += '?time=' + new Date().getTime()
this.data.texPngData.url += '?time=' + new Date().getTime()
}
this._animaResList.push({ url: this.data.skeJsonData.url || '' });
this._animaResList.push({ url: this.data.texJsonData.url || '' });
this._animaResList.push({ url: this.data.texPngData.url || '' });
this._animaResList.push({ url: this.data.texJsonData.url || ''});
this._animaResList.push({ url: this.data.texPngData.url || ''});
}
onLoadEnd() {
......@@ -44,8 +48,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
let isAnimLoaded = false;
const checkStart = () => {
console.log(' in checkStart: ', isDataLoaded)
console.log(' in isAnimLoaded: ', isAnimLoaded)
console.log( ' in checkStart: ', isDataLoaded)
console.log( ' in isAnimLoaded: ', isAnimLoaded)
if (isDataLoaded && isAnimLoaded) {
window["air"].hideAirClassLoading();
......@@ -92,7 +96,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.isFirst = data.first; //this.checkIsFirst();
this.isLast = data.last // this.checkIsLast();
this.playTimes = data.playTime // this.checkPlayTimes();
this.playTimes = data.playTime// this.checkPlayTimes();
this.jumpData = data.saveData // this.getJumpData();
if (this.data.isDebug) {
......@@ -144,7 +148,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
return;
}
for (let i = 0; i < lyrics.length; i++) {
for (let i=0; i<lyrics.length; i++) {
const data = lyrics[i].data;
if (!data) {
......@@ -155,10 +159,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
let duration = 0;
if (i != lyrics.length - 1) {
duration = lyrics[i + 1].time - lyrics[i].time;
duration = lyrics[i+1].time - lyrics[i].time;
}
this.textArr.push({ data, time, duration });
this.textArr.push({data, time, duration});
}
}
......@@ -179,7 +183,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
initView() {
console.log(' in initView')
console.log( ' in initView')
if (this.jumpData) {
this.junpAnim();
......@@ -203,10 +207,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
junpAnim() {
const jumpFrame = this.getJumpFrame();
this.dragonDisplay.timeScale = jumpFrame;
this.dragonDisplay.armatureName = this.dragonDisplay.getArmatureNames()[0];
const animationName = this.dragonDisplay.getAnimationNames(this.dragonDisplay.armatureName)[0];
this.dragonDisplay.playAnimation(animationName, 1);
this.dragonDisplay.playAnimation(this.animaNode.animationNames[0], 1);
}
getJumpFrame() {
......@@ -219,9 +220,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
let disFrame = maxDisFrame;
for (let i = 1; i < arr.length; i++) {
for (let i=1; i<arr.length; i++) {
const curDis = (arr[i].text - arr[i - 1].text) / 2;
const curDis = (arr[i].text - arr[i-1].text) / 2;
if (disFrame > curDis) {
disFrame = curDis;
}
......@@ -263,10 +264,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
lightLeft.rotation = 45;
lightLeft.opacity = 0;
cc.tween(lightLeft)
.to(1, { rotation: -45 }, { easing: "cubicOut" })
.to(1, {rotation: -45}, {easing: "cubicOut"})
.start();
cc.tween(lightLeft)
.to(0.5, { opacity: 255 })
.to(0.5, {opacity: 255})
.start();
const lightRight = this.getSprNode('light');
......@@ -279,10 +280,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
lightRight.rotation = -45;
lightRight.opacity = 0;
cc.tween(lightRight)
.to(1, { rotation: 45 }, { easing: "cubicOut" })
.to(1, {rotation: 45}, {easing: "cubicOut"})
.start();
cc.tween(lightRight)
.to(0.5, { opacity: 255 })
.to(0.5, {opacity: 255})
.start();
......@@ -309,7 +310,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.startAudioEnd();
}));
})
.to(1.5, { y: 0 }, { easing: "elasticOut" })
.to(1.5, {y: 0}, {easing: "elasticOut"})
.start();
this.title = title
......@@ -337,13 +338,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
sprNode.opacity = 0;
cc.tween(sprNode)
.to(time / 10, { opacity: 255 })
.to(time/10, {opacity: 255})
.start();
cc.tween(sprNode)
.to(0.8 * time, { scale: this._mapScaleMin }, { easing: 'elasticOut' })
.to(0.8 * time, {scale: this._mapScaleMin}, {easing: 'elasticOut'})
.delay(0 * time)
.to(0.2 * time, { opacity: 0 })
.to(0.2 * time, {opacity: 0})
.start();
}
......@@ -376,9 +377,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
async hideStartView() {
const hideSpr = (sprNode, cb = null) => {
const hideSpr = (sprNode, cb=null) => {
cc.tween(sprNode)
.to(0.3, { opacity: 0 })
.to(0.3, {opacity: 0})
.call(() => {
sprNode.active = false;
cb && cb();
......@@ -401,10 +402,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
startAnim() {
if (this.animaNode) {
this.dragonDisplay.armatureName = this.dragonDisplay.getArmatureNames()[0];
const animationName = this.dragonDisplay.getAnimationNames(this.dragonDisplay.armatureName)[0];
this.dragonDisplay.playAnimation(animationName, 1);
this.dragonDisplay.playAnimation(this.animaNode.animationNames[0], 1);
this.dragonDisplay.timeScale = 1;
}
......@@ -431,7 +430,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
callMiddleLayerFunction('PSQS_jump_to_question', { step: id }, null)
callMiddleLayerFunction('PSQS_jump_to_question', {step: id}, null)
return;
}
......@@ -476,8 +475,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
// this.delayDeleteAnim();
hand.removeFromParent();
console.log('PSQS_show_rabbit 2')
callMiddleLayerFunction('PSQS_jump_to_question', { step: id }, null)
callMiddleLayerFunction('PSQS_jump_to_question', {step: id}, null)
// })
})
}
......@@ -490,6 +490,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
middleLayer.myAnimNode = null;
return;
let dragonDisplay = this.animaNode.getComponent(dragonBones.ArmatureDisplay);
const oldAtlas = dragonDisplay.dragonAtlasAsset;
......@@ -502,22 +505,23 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.delayRelease(oldAtlas, oldAsset, this.animaNode);
console.log(' setOneAnima 101')
// console.log(' setOneAnima 101')
this.animaNode.removeComponent(dragonBones.ArmatureDisplay)
dragonDisplay = this.animaNode.addComponent(dragonBones.ArmatureDisplay);
// dragonDisplay = this.animaNode.addComponent(dragonBones.ArmatureDisplay);
const handBase = cc.find("Canvas/hand");
const hand = cc.instantiate(handBase);
hand.active = true;
const handDisplay = hand.getComponent(dragonBones.ArmatureDisplay)
// const handBase = cc.find("Canvas/hand");
// const hand = cc.instantiate(handBase);
// hand.active = true;
// const handDisplay = hand.getComponent(dragonBones.ArmatureDisplay)
// const atlas = new dragonBones.DragonBonesAtlasAsset();
// const asset = new dragonBones.DragonBonesAsset();
// // const atlas = new dragonBones.DragonBonesAtlasAsset();
// // const asset = new dragonBones.DragonBonesAsset();
dragonDisplay.dragonAtlasAsset = handDisplay.dragonAtlasAsset;
dragonDisplay.dragonAsset = handDisplay.dragonAsset;
console.log('汪汪汪 21')
// dragonDisplay.dragonAtlasAsset = handDisplay.dragonAtlasAsset;
// dragonDisplay.dragonAsset = handDisplay.dragonAsset;
// console.log('汪汪汪 21')
oldAsset.decRef();
......@@ -544,7 +548,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
jumpAudio(id) {
console.log('in jumpAudio id: ', id);
const stepData = this.data.stepArr[id - 1];
const stepData = this.data.stepArr[id-1];
console.log('stepData: ', stepData);
const time = stepData.text / this.data.frame;
......@@ -607,13 +611,19 @@ export default class SceneComponent extends MyCocosSceneComponent {
const dragonDisplay = goodjob.getComponent(dragonBones.ArmatureDisplay);
dragonDisplay.playAnimation('newAnimation', 1);
playAudio(this.goodjobClip);
playAudio(this.goodjobClip, () => {
// this.delayDeleteAnim();
this.changeToMiddleLayer();
callMiddleLayerFunction('PSQS_play_animate_over', null, () => {})
});
// asyncDelay(2);
// this.showBack();
// dragonDisplay.on(dragonBones.EventObject.COMPLETE, (e) => {
// // this.animPlayEnd();
// })
}
......@@ -625,13 +635,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
back.scale = 0.3;
back.opacity = 0
cc.tween(back)
.to(0.9, { scale: this._mapScaleMin, opacity: 255 }, { easing: 'elasticOut' })
.to(0.9, {scale: this._mapScaleMin, opacity:255}, {easing: 'elasticOut'})
.start();
back.addComponent(cc.Button);
back.on('click', () => {
console.log('click back')
callMiddleLayerFunction('PSQS_exit_book', null, () => { });
callMiddleLayerFunction('PSQS_exit_book', null, () => {});
})
}
......@@ -646,7 +656,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
console.log(' in animPlayEnd 2')
// setTimeout(() => {
callMiddleLayerFunction('PSQS_play_animate_over', null, () => { })
callMiddleLayerFunction('PSQS_play_animate_over', null, () => {})
// }, 100);
// callMiddleLayerFunction('PSQS_play_animate_over', this.animaNode, () => {})
// })
......@@ -655,12 +665,18 @@ export default class SceneComponent extends MyCocosSceneComponent {
changeToMiddleLayer() {
return;
// return;
this.cleanListener();
const middleLayer = <any>cc.find("middleLayer");
if (middleLayer) {
if (!this.animaNode || this.animaNode.parent == middleLayer) {
return;
}
this.cleanListener();
// middleLayer.myAnimNode.parent = middleLayer
// this.animaNode.updateScale(middleLayer);
......@@ -675,12 +691,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
this.dragonDisplay.dragonAtlasAsset.addRef();
this.dragonDisplay.dragonAsset.addRef();
// setTimeout(() => {
console.log('in changeToMiddleLayer 2 ');
......@@ -689,37 +699,91 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
async setOneAnima1(data, cb) {
if (!data.texPngData) {
return
dragonDisplay;
animaNode;
maxTexture;
setOneAnima(data, cb) {
console.log(' setOneAnima 1')
// let animaNode = new cc.Node();
// let dragonDisplay = animaNode.addComponent(dragonBones.ArmatureDisplay);
const middleLayer = <any>cc.find("middleLayer");
// let myAnimNode = middleLayer?.myAnimNode;
let animaNode = middleLayer?.myAnimNode;
let dragonDisplay;
if (!animaNode) {
console.log(' setOneAnima 2')
animaNode = new cc.Node();
dragonDisplay = animaNode.addComponent(dragonBones.ArmatureDisplay);
const mapMaxScale = this._mapScaleMax;
const data = this.data;
animaNode.updateScale = (oldS, newS) => {
console.log('in updateScale 1');
const cScale = oldS;
const mScale = newS;
animaNode.scale = cScale / mScale * mapMaxScale;
if (data.scale) {
animaNode.scale *= data.scale;
console.log('in updateScale 2');
}
await asyncLoadDragonBoneAnime(this.canvas, data);
const animaNode = this.canvas.animaNode;
}
if (middleLayer) {
console.log(' setOneAnima 3')
middleLayer.myAnimNode = animaNode;
}
} else {
console.log(' setOneAnima 4')
dragonDisplay = animaNode.getComponent(dragonBones.ArmatureDisplay);
console.log('animaNode.animBaseUr: ' + animaNode.animBaseUr );
if (animaNode.animBaseUrl == this.animBaseUrl) {
animaNode.parent = this.canvas;
animaNode.scale = this._mapScaleMax;
if (this.data.scale) {
animaNode.scale *= this.data.scale;
}
const dragonDisplay = animaNode.getComponent(dragonBones.ArmatureDisplay);
dragonDisplay.armatureName = dragonDisplay.getArmatureNames()[0];
const animationName = dragonDisplay.getAnimationNames(dragonDisplay.armatureName)[0];
dragonDisplay.playAnimation(animationName, 1);
dragonDisplay.playAnimation(animaNode['animationNames'][0], 1);
dragonDisplay.timeScale = 0;
dragonDisplay.off(dragonBones.EventObject.FRAME_EVENT)
dragonDisplay.on(dragonBones.EventObject.FRAME_EVENT, (event) => {
console.log(' setOneAnima 13')
const frameEventFunc = (e) => {
console.log(' in frameEventFunc ')
if (this.playTimes > 0) {
this.animChangeStep(event.name);
this.animChangeStep(e['name']);
}
})
};
dragonDisplay.off(dragonBones.EventObject.FRAME_EVENT)
dragonDisplay.on(dragonBones.EventObject.FRAME_EVENT, frameEventFunc)
dragonDisplay.off(dragonBones.EventObject.COMPLETE)
dragonDisplay.on(dragonBones.EventObject.COMPLETE, () => {
console.log(' setOneAnima 14')
const compFunc = (e) => {
console.log(' in compFunc ')
if (this.isLast && this.playTimes > 0) {
......@@ -727,80 +791,41 @@ export default class SceneComponent extends MyCocosSceneComponent {
} else {
this.animPlayEnd();
}
})
}
dragonDisplay.off(dragonBones.EventObject.COMPLETE)
dragonDisplay.on(dragonBones.EventObject.COMPLETE, compFunc)
console.log(' setOneAnima 15')
const touchFunc = (e) => {
console.log(' in touchFunc ')
animaNode.off('touchstart')
animaNode.on('touchstart', (e) => {
const pos = e.getLocation();
const x = pos.x// - e.currentTarget.width / 2;
const y = pos.y// - e.currentTarget.height / 2;
const newPos = animaNode.convertToNodeSpaceAR(cc.v2(x, y));
console.log('X: ', Math.round(newPos.x));
console.log('Y: ', Math.round(newPos.y));
});
console.log('X: ', Math.round( newPos.x ));
console.log('Y: ', Math.round( newPos.y ));
}
animaNode.off('touchstart')
animaNode.on('touchstart', touchFunc)
console.log(' setOneAnima 16')
this.dragonDisplay = dragonDisplay;
this.animaNode = animaNode;
cb && cb();
}
dragonDisplay;
animaNode;
maxTexture;
setOneAnima(data, cb) {
this.setOneAnima1(data, cb);
return;
}
}
console.log(' setOneAnima 1')
let animaNode = new cc.Node();
let dragonDisplay = animaNode.addComponent(dragonBones.ArmatureDisplay);
// const middleLayer = <any>cc.find("middleLayer");
// let myAnimNode = middleLayer?.myAnimNode;
// let animaNode ; //= middleLayer?.myAnimNode;
// let dragonDisplay;
// if (!animaNode || true) {
// console.log(' setOneAnima 2')
// animaNode = new cc.Node();
// dragonDisplay = animaNode.addComponent(dragonBones.ArmatureDisplay);
// const mapMaxScale = this._mapScaleMax;
// const data = this.data;
// animaNode.updateScale = (oldS, newS) => {
// console.log('in updateScale 1');
// const cScale = oldS;
// const mScale = newS;
// animaNode.scale = cScale / mScale * mapMaxScale;
// if (data.scale) {
// animaNode.scale *= data.scale;
// console.log('in updateScale 2');
// }
// }
// if (middleLayer) {
// console.log(' setOneAnima 3')
// middleLayer.myAnimNode = animaNode;
// }
// } else {
// console.log(' setOneAnima 4')
animaNode.parent = this.canvas;
// dragonDisplay = animaNode.getComponent(dragonBones.ArmatureDisplay);
// }
animaNode.parent = this.canvas;
......@@ -816,8 +841,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
// let oldAtlas;
// let oldAsset;
let oldAtlas = dragonDisplay.dragonAtlasAsset
let oldAsset = dragonDisplay.dragonAsset;
// if (myAnimNode) {
// const oldDragonDisplay = myAnimNode.getComponent(dragonBones.ArmatureDisplay)
// oldAtlas = oldDragonDisplay.dragonAtlasAsset;
......@@ -842,10 +867,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
console.log(' setOneAnima 8')
animaNode.animBaseUrl = this.animBaseUrl;
// console.log(' jumpData == null ');
// this.delayRelease(oldAtlas, oldAsset)
this.delayRelease(oldAtlas, oldAsset)
// setTimeout(() => {
......@@ -867,10 +892,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
// }, 2000);
// this.maxTexture = texture;
// const atlas = new dragonBones.DragonBonesAtlasAsset();
// atlas.atlasJson = atlasJson;
// atlas.texture = texture;
const atlas = new dragonBones.DragonBonesAtlasAsset();
atlas.atlasJson = JSON.stringify(atlasJson);
......@@ -883,18 +905,18 @@ export default class SceneComponent extends MyCocosSceneComponent {
// console.log(' setOneAnima 10')
// animaNode.removeComponent(dragonBones.ArmatureDisplay)
// dragonDisplay = animaNode.addComponent(dragonBones.ArmatureDisplay);
animaNode.removeComponent(dragonBones.ArmatureDisplay)
dragonDisplay = animaNode.addComponent(dragonBones.ArmatureDisplay);
console.log('dragonDisplay = ' + typeof (dragonDisplay));
console.log('dragonDisplay = ' + typeof(dragonDisplay));
dragonDisplay.dragonAtlasAsset = atlas;
console.log('汪汪汪 1')
dragonDisplay.dragonAsset = asset;
console.log('汪汪汪 2')
console.log('type: ' + typeof (asset.dragonBonesJson));
console.log('type: ' + typeof(asset.dragonBonesJson));
let json = JSON.parse(asset.dragonBonesJson);
console.log('json: ', json);
......@@ -996,8 +1018,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
const y = pos.y// - e.currentTarget.height / 2;
const newPos = animaNode.convertToNodeSpaceAR(cc.v2(x, y));
console.log('X: ', Math.round(newPos.x));
console.log('Y: ', Math.round(newPos.y));
console.log('X: ', Math.round( newPos.x ));
console.log('Y: ', Math.round( newPos.y ));
}
animaNode.off('touchstart')
animaNode.on('touchstart', touchFunc)
......@@ -1019,7 +1041,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
delayRelease(oldAtlas, oldAsset, delteItem = null) {
delayRelease(oldAtlas, oldAsset, delteItem=null) {
setTimeout(() => {
......@@ -1071,7 +1093,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
getCurTextObj() {
const data = this.textArr[this.textArrIndex];
if (data) {
this.textArrIndex++;
this.textArrIndex ++;
}
return data;
}
......@@ -1103,18 +1125,18 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.textLabel.node.opacity = 0;
this.textLabel.string = `<outline color=white width=4>${textObj.data}</outline>`
if (textObj.duration) {
if (textObj.duration ) {
this.textLabel.curTween = cc.tween(this.textLabel.node)
.to(0.2, { opacity: 255 }, { easing: 'sineOut' })
.delay(textObj.duration)
.to(0.2, {opacity: 255}, {easing: 'sineOut'})
.delay(textObj.duration )
.call(() => {
this.curTextObj = null;
})
.to(0.1, { opacity: 0 })
.to(0.1, {opacity: 0})
.start();
} else {
this.textLabel.curTween = cc.tween(this.textLabel.node)
.to(0.2, { opacity: 255 }, { easing: 'sineOut' })
.to(0.2, {opacity: 255}, {easing: 'sineOut'})
.start();
}
......@@ -1122,7 +1144,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
getTextLabel() {
const richTextNode = new cc.Node();
richTextNode.y = -this.canvas.height / 2 + 20 * this._mapScaleMin;
richTextNode.y = -this.canvas.height / 2 + 20 * this._mapScaleMin ;
richTextNode.opacity = 0;
richTextNode.anchorY = 0;
richTextNode.scale = this._mapScaleMin;
......@@ -1154,7 +1176,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
update(dt) {
update (dt) {
this.checkShowText();
}
......@@ -1173,23 +1195,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
// if (cc.assetManager.cacheManager) {
// cc.assetManager.cacheManager.clearCache()
// }
}
onDestroy() {
console.log(' in onDestroy');
this.changeToMiddleLayer();
this.releaseAssets();
this.animaNode.removeFromParent();
setTimeout(() => {
if (this.dragonDisplay) {
this.dragonDisplay.dragonAtlasAsset.texture.destroy();
this.dragonDisplay.dragonAtlasAsset.destroy();
this.dragonDisplay.dragonAsset.destroy();
} else {
console.log('没有 this.dragonDisplay');
}
}, 100);
}
}
{
"ver": "1.0.8",
"uuid": "01bc5c21-35e0-4df7-b45c-91e1db6bbc36",
"uuid": "e7337c8c-450c-46fb-aeb5-1aa6589c1cfb",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
......
{
"ver": "1.1.2",
"uuid": "5b4367d7-2537-43d5-a7a9-fc5f5d405ad7",
"uuid": "401ac718-ac5b-4b4e-88c2-84e3e7f79d10",
"isBundle": false,
"bundleName": "",
"priority": 1,
......
{
"ver": "1.0.8",
"uuid": "d45ef1e1-912a-4371-9361-ab0290acf8af",
"uuid": "0396b813-deda-4e71-98eb-4f7b5a97607c",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
......
{
"ver": "1.0.8",
"uuid": "c749ea77-e186-4b60-a021-1e831ba379fe",
"uuid": "e9c5064b-a25a-43b8-ba33-64c47c70d131",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
......
{
"ver": "1.0.8",
"uuid": "1b178e19-5ecd-429a-8dd8-52679bc75984",
"uuid": "3893e755-d172-4335-b9e0-ae6aadba3294",
"isPlugin": true,
"loadPluginInWeb": true,
"loadPluginInNative": true,
......
{
"ver": "1.0.8",
"uuid": "4cc23ada-e360-4564-b768-acb660c771c5",
"uuid": "38cd9b53-2899-49cc-ba1c-8a9068d1acd8",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
......
{
"ver": "1.1.2",
"uuid": "34401cf5-d596-4a35-be37-4376e7031008",
"uuid": "c6308b3b-beda-4402-a1e3-cc77e84e09ad",
"isBundle": false,
"bundleName": "",
"priority": 1,
......
{
"ver": "2.3.5",
"uuid": "98d57d91-eae8-4740-8a30-6c3f7ed3311e",
"uuid": "b455337b-0e9e-4450-ada2-792d01880695",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
......@@ -13,8 +13,8 @@
"subMetas": {
"back": {
"ver": "1.0.4",
"uuid": "21c46819-635d-44f1-8802-24eed947ec47",
"rawTextureUuid": "98d57d91-eae8-4740-8a30-6c3f7ed3311e",
"uuid": "7970e7a4-3344-4654-869e-7d86525d538f",
"rawTextureUuid": "b455337b-0e9e-4450-ada2-792d01880695",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
......
{
"ver": "2.3.5",
"uuid": "601273b3-10f8-4a15-800a-2b9417d13e35",
"uuid": "9567fd25-2231-4c00-b3c9-d015ceed71f2",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
......@@ -13,8 +13,8 @@
"subMetas": {
"black": {
"ver": "1.0.4",
"uuid": "5da77720-589f-4569-80d9-9b1718a36c81",
"rawTextureUuid": "601273b3-10f8-4a15-800a-2b9417d13e35",
"uuid": "5b6844fd-84de-4a0b-a953-94fde6c64547",
"rawTextureUuid": "9567fd25-2231-4c00-b3c9-d015ceed71f2",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
......
{
"ver": "2.3.5",
"uuid": "1927e1c3-9502-4e94-ad9c-cbe7c6fec162",
"uuid": "3ff6bf5a-5ddf-44d8-9e4a-2d8eed711245",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
......@@ -13,8 +13,8 @@
"subMetas": {
"go_0": {
"ver": "1.0.4",
"uuid": "f14ac956-031f-41f0-8fb4-4b00647c02f7",
"rawTextureUuid": "1927e1c3-9502-4e94-ad9c-cbe7c6fec162",
"uuid": "7c55e90a-88f6-4947-baa2-b9a67ba52f5d",
"rawTextureUuid": "3ff6bf5a-5ddf-44d8-9e4a-2d8eed711245",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
......
{
"ver": "2.3.5",
"uuid": "bee5d541-20f4-4fa6-8c3d-b5f1df589d38",
"uuid": "541c12f0-7a8c-4565-b00d-6a475d510006",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
......@@ -13,8 +13,8 @@
"subMetas": {
"go_1": {
"ver": "1.0.4",
"uuid": "0c4f7341-41d9-4cea-a05d-6777dddb3b86",
"rawTextureUuid": "bee5d541-20f4-4fa6-8c3d-b5f1df589d38",
"uuid": "0a814c8c-7ec2-49fe-84a1-82cb2d97397c",
"rawTextureUuid": "541c12f0-7a8c-4565-b00d-6a475d510006",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
......
{
"ver": "2.3.5",
"uuid": "d3bfcc1a-4426-45f4-b88d-2cb22eb55888",
"uuid": "19adb859-2213-4922-bc8f-c5301ec05684",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
......@@ -13,8 +13,8 @@
"subMetas": {
"go_2": {
"ver": "1.0.4",
"uuid": "236c2bbd-77a1-4f2e-b4c1-7338f549a8d5",
"rawTextureUuid": "d3bfcc1a-4426-45f4-b88d-2cb22eb55888",
"uuid": "c76ff575-367c-4f43-bed2-2673f9bbeb91",
"rawTextureUuid": "19adb859-2213-4922-bc8f-c5301ec05684",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
......
{
"ver": "2.3.5",
"uuid": "77f031b8-d8b6-4894-9dc5-94990c2269b3",
"uuid": "4d4ee228-6710-482c-8b37-27d3fd579047",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
......@@ -13,8 +13,8 @@
"subMetas": {
"go_3": {
"ver": "1.0.4",
"uuid": "9231a078-9119-4563-af21-88c1a2720b6b",
"rawTextureUuid": "77f031b8-d8b6-4894-9dc5-94990c2269b3",
"uuid": "f9729f00-7d67-4824-808e-db4f2743b2ad",
"rawTextureUuid": "4d4ee228-6710-482c-8b37-27d3fd579047",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
......
{
"ver": "2.3.5",
"uuid": "aec153f2-a8d7-440c-a716-e1832c82cfdd",
"uuid": "c084885e-3a84-4a14-a24e-267fb24aef7e",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
......@@ -13,8 +13,8 @@
"subMetas": {
"light": {
"ver": "1.0.4",
"uuid": "3c775c24-d497-4961-bef3-c07596a41a72",
"rawTextureUuid": "aec153f2-a8d7-440c-a716-e1832c82cfdd",
"uuid": "17c172fa-3ad0-4f60-a6b7-a2e8cee68772",
"rawTextureUuid": "c084885e-3a84-4a14-a24e-267fb24aef7e",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
......
{
"ver": "2.3.5",
"uuid": "5e58a84c-2d04-4d5f-bf57-e1e735a1f75b",
"uuid": "2a320afe-8db9-4e15-8811-f914c95b4758",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
......@@ -13,8 +13,8 @@
"subMetas": {
"start_title": {
"ver": "1.0.4",
"uuid": "5ed3c2b7-e11c-468f-98a4-99264a4377a4",
"rawTextureUuid": "5e58a84c-2d04-4d5f-bf57-e1e735a1f75b",
"uuid": "9bc3a9ad-b2e2-4811-b037-148edbc3224e",
"rawTextureUuid": "2a320afe-8db9-4e15-8811-f914c95b4758",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
......
{
"title": "play",
"packageName": "org.cocos2d.demo",
"startScene": "9ef4faa1-84f0-4742-95d2-d2eaf214f37d",
"startScene": "4a29e4b1-f8b4-4b6a-b305-7d4b475e23a1",
"excludeScenes": [],
"includeSDKBox": false,
"orientation": {
......
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