Commit 236d0c5d authored by Tt's avatar Tt

动画加载完成

parent 6aa3f9b9
......@@ -27,8 +27,8 @@ class GameManager {
obj.sound = ar.wordAudio;
obj.img = ar.bgImg;
obj.cartoonSke = ar.imgAni.ske.url;
obj.cartoonTex = ar.imgAni.ske.url;
obj.cartoonPng = ar.imgAni.ske.url;
obj.cartoonTex = ar.imgAni.tex.url;
obj.cartoonPng = ar.imgAni.png.url;
this._list.push(obj);
}
console.log(this._list);//原始数据转为数组
......
......@@ -247,6 +247,33 @@ pg.view = {
},
cloneNode(node) {
return cc.instantiate(node);
},
loadDB(item, config) {
return new Promise((resolve, reject) => {
pg.load.loadNetRes(config.png).then((png) => {
pg.load.loadNetRes(config.ske).then((ske) => {
pg.load.loadNetRes(config.tex).then((tex) => {
var atlas = new dragonBones.DragonBonesAtlasAsset();
atlas.atlasJson = JSON.stringify(tex.json);
atlas.texture = png;
var asset = new dragonBones.DragonBonesAsset();
asset.dragonBonesJson = JSON.stringify(ske.json);
let dragonDisplay = item.getComponent(dragonBones.ArmatureDisplay);
dragonDisplay.dragonAtlasAsset = atlas;
dragonDisplay.dragonAsset = asset;
//设置
let defaultArmature = ske.json.armature[0];//aramture 所有的骨骼名称
dragonDisplay.armatureName = defaultArmature.name;
resolve(defaultArmature.animation[0].name);
})
})
})
});
}
}
//加载 未封装bundle
......@@ -260,6 +287,14 @@ pg.load = {
});
})
},
loadNetRes: function (url) {
return new Promise((resolve, reject) => {
cc.assetManager.loadRemote(url, (err, info) => {
if (err && !data) return resolve(pg.logger.w('loading loadRes warn-> ', res));
resolve(info);
});
})
},
loadImg: function () {
return new Promise((resolve, reject) => {
this.loadRes(url, cc.SpriteFrame).then((data) => {
......
......@@ -807,13 +807,13 @@
},
{
"__type__": "cc.Node",
"_name": "apple_ske",
"_name": "carton",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": false,
"_active": true,
"_components": [
{
"__id__": 16
......@@ -830,8 +830,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 773,
"height": 1000.0000000000008
"width": 362.6105263157899,
"height": 483.5647539622176
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -880,32 +880,28 @@
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_armatureName": "Armature",
"_animationName": "apple",
"_armatureName": "",
"_animationName": "",
"_preCacheMode": 0,
"_cacheMode": 0,
"playTimes": -1,
"premultipliedAlpha": false,
"_armatureKey": "0c3549c9-9951-47a1-9c7d-c1eeb12ceff2#bd58c477-0554-44be-8fde-701542d0ce66",
"_armatureKey": "0ec7ccd1-a7be-4ed4-8964-d9f90fb9c1c9#348d2f21-e4da-4ff3-b20c-c769e12aa82c",
"_accTime": 0,
"_playCount": 0,
"_frameCache": null,
"_curFrame": null,
"_playing": false,
"_armatureCache": null,
"_N$dragonAsset": {
"__uuid__": "0c3549c9-9951-47a1-9c7d-c1eeb12ceff2"
},
"_N$dragonAtlasAsset": {
"__uuid__": "bd58c477-0554-44be-8fde-701542d0ce66"
},
"_N$dragonAsset": null,
"_N$dragonAtlasAsset": null,
"_N$_defaultArmatureIndex": 0,
"_N$_animationIndex": 1,
"_N$_animationIndex": 0,
"_N$_defaultCacheMode": 0,
"_N$timeScale": 1,
"_N$debugBones": false,
"_N$enableBatch": false,
"_id": "f7NZhjd8BPd6HSzCaPOI6X"
"_id": "57SOuId/NBbpwfQXVa7l9o"
},
{
"__type__": "cc.Node",
......
......@@ -182,6 +182,7 @@ cc.Class({
let progress = pg.view.find(this, "progress")
let end = pg.view.find(this, "end");
let end_success = pg.view.find(end, "bg_success")
let carton = pg.view.find(this, "carton")
let bg_book = pg.view.find(this, "bg_book");
let icon_ex = pg.view.find(this, "icon_ex");
let btn_next = pg.view.find(this, "btn_next");
......@@ -190,7 +191,10 @@ cc.Class({
if (GameManager.getIns().getState() == 0) {
//拓展加载动画的内容
pg.view.loadDB(carton, { ske: this._stageData.cartoonSke, tex: this._stageData.cartoonTex, png: this._stageData.cartoonPng }).then((animationName) => {
let dragonDisplay = carton.getComponent(dragonBones.ArmatureDisplay);
dragonDisplay.playAnimation(animationName, 1);//animation所有的动画名称
})
//拓展文字显示的动画
pg.view.visible(end, false);//不显示的内容用false
......
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