Merge pull request #622 from natural-law/tiledmap

Solve the error that can't get the content of depended RawAsset by url.
This commit is contained in:
pandamicro
2016-04-26 13:59:11 +08:00
3 changed files with 22 additions and 2 deletions
+9
View File
@@ -263,6 +263,15 @@ function downloadUuid (item, callback) {
item.url = url;
item.isRawAsset = isRawAsset;
if (isRawAsset) {
self.pipeline._items.map[url] = {
id: url,
url: url,
type: Path.extname(url).toLowerCase().substr(1),
error: null,
alias: item.id,
complete: true
};
var ext = Path.extname(url).toLowerCase();
if (!ext) {
callback(new Error('Download Uuid: can not find type of raw asset[' + uuid + ']: ' + url));
+11 -1
View File
@@ -124,7 +124,17 @@ JS.mixin(LoadingItems.prototype, CallbacksInvoker.prototype, {
*/
getContent: function (id) {
var item = this.map[id];
return item ? item.content : null;
var ret = null;
if (item) {
if (item.content) {
ret = item.content;
}
else if (item.alias) {
ret = this.getContent(item.alias);
}
}
return ret;
},
/**
+2 -1
View File
@@ -177,7 +177,7 @@ var TiledMap = cc.Class({
},
_tmxFile: {
default: '',
default: null,
type: cc.TiledMapAsset
},
/**
@@ -671,6 +671,7 @@ var TiledMap = cc.Class({
var child = logicChildren[i];
var tmxLayer = child.getComponent(cc.TiledLayer);
var zOrderValue = child.getSiblingIndex();
child.setLocalZOrder(zOrderValue);
if (tmxLayer) {
if (tmxLayer._sgNode) {
tmxLayer._sgNode.setLocalZOrder(zOrderValue);