mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 08:02:39 +08:00
Solve the error effect of DragonBones when re-enter an auto-released scene.
This commit is contained in:
@@ -341,8 +341,26 @@ dragonBones.ArmatureDisplay = cc.Class({
|
||||
this._factory.parseTextureAtlasData(this.dragonAtlasAsset.atlasJson, this.dragonAtlasAsset.texture);
|
||||
} else {
|
||||
var atlasJsonObj = JSON.parse(this.dragonAtlasAsset.atlasJson);
|
||||
var texture = cc.textureCache.getTextureForKey(this.dragonAtlasAsset.texture);
|
||||
this._factory.parseTextureAtlasData(atlasJsonObj, texture);
|
||||
var atlasName = atlasJsonObj.name;
|
||||
var existedAtlasData = null;
|
||||
var atlasDataList = this._factory.getTextureAtlasData(atlasName);
|
||||
var texturePath = this.dragonAtlasAsset.texture;
|
||||
if (atlasDataList && atlasDataList.length > 0) {
|
||||
for (var idx in atlasDataList) {
|
||||
var data = atlasDataList[idx];
|
||||
if (data && data.texture && data.texture.url === texturePath) {
|
||||
existedAtlasData = data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var texture = cc.textureCache.getTextureForKey(texturePath);
|
||||
if (existedAtlasData) {
|
||||
existedAtlasData.texture = texture;
|
||||
} else {
|
||||
this._factory.parseTextureAtlasData(atlasJsonObj, texture);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -129,7 +129,8 @@ dragonBones.CCSlot = cc.Class({
|
||||
|
||||
if (currentTextureData) {
|
||||
var textureAtlasTexture = currentTextureData.parent.texture;
|
||||
if (!currentTextureData.texture && textureAtlasTexture) {
|
||||
if ((!currentTextureData.texture && textureAtlasTexture) ||
|
||||
(currentDisplayData.texture && textureAtlasTexture && currentTextureData.texture.getTexture() !== textureAtlasTexture)){
|
||||
// Create and cache texture
|
||||
var rect = cc.rect(currentTextureData.region.x, currentTextureData.region.y,
|
||||
currentTextureData.region.width, currentTextureData.region.height);
|
||||
|
||||
Reference in New Issue
Block a user