Merge branch 'v3.7.1' of github.com:cocos2d/cocos2d-x into 3.7.1

Conflicts:
	cocos/editor-support/cocostudio/ActionTimeline/CCBoneNode.cpp
This commit is contained in:
geron-cn 2015-08-07 15:48:33 +08:00
commit e1108c594c
4 changed files with 145 additions and 14 deletions

View File

@ -147,14 +147,10 @@ namespace cocostudio
auto fileData = options->fileData();
std::string path = fileData->path()->c_str();
ParticleSystem3D* ret = NULL;
if(!FileUtils::getInstance()->isFileExist(path))
PUParticleSystem3D* ret = PUParticleSystem3D::create();
if (FileUtils::getInstance()->isFileExist(path))
{
ret = PUParticleSystem3D::create();
}
else
{
ret = PUParticleSystem3D::create(path);
ret->initWithFilePath(path);
}
setPropsWithFlatBuffers(ret, particle3DOptions);

View File

@ -1519,10 +1519,12 @@
if(json["FileData"] && json["FileData"]["Path"])
resFile = resourcePath + json["FileData"]["Path"];
var node;
if(resFile)
var node = null;
if(resFile) {
if(jsb.fileUtils.isFileExist(resFile))
node = jsb.Sprite3D.create(resFile);
else
}
if(null === node)
node = jsb.Sprite3D.create();
if(node) {
@ -1561,9 +1563,12 @@
if(json["FileData"] && json["FileData"]["Path"])
resFile = resourcePath+json["FileData"]["Path"];
if(resFile)
if(resFile){
if(jsb.fileUtils.isFileExist(resFile))
node = jsb.PUParticleSystem3D.create(resFile);
else
}
if(null === node)
node = jsb.PUParticleSystem3D.create();
if(node){

View File

@ -38,6 +38,8 @@ PUParticleSystem3DTranslator::~PUParticleSystem3DTranslator()
void PUParticleSystem3DTranslator::translate(PUScriptCompiler* compiler, PUAbstractNode *node)
{
if (typeid(*node) != typeid(PUObjectAbstractNode))
return;
PUObjectAbstractNode* obj = reinterpret_cast<PUObjectAbstractNode*>(node);
if(obj->name.empty())

View File

@ -83,6 +83,134 @@ var LoaderTestLayer = BaseTestLayer.extend({
sprite.y = winSize.height/2;
});
},
onNextCallback: function(){
var parent = this.getParent();
parent.removeChild(this);
parent.addChild(new LoaderCycleLayer());
}
});
var LoaderCycleLayer = BaseTestLayer.extend({
_title:"Failed to load Test",
_subtitle:"",
ctor: function(){
BaseTestLayer.prototype.ctor.call(this);
var index = 0;
var winSize = cc.director.getWinSize();
var t = this,
cb = function(num){
var labelTTF = new cc.LabelTTF(num + " file failed");
labelTTF.x = index++*100 + winSize.width - 150;
labelTTF.y = winSize.height / 2 - 20;
if(num === 1)
labelTTF.setColor(cc.color.GREEN);
else
labelTTF.setColor(cc.color.RED);
t.addChild(labelTTF);
if(index < 4)
t.test(cb);
};
this.createInfo();
this.regLoad();
this.test(cb);
},
regLoad: function(){
cc.loader.register(["_test1"], {
load: function(realUrl, url, res, cb){
cc.loader.cache[url] = {};
setTimeout(function(){
cb && cb(null, cc.loader.cache[url]);
return cc.loader.cache[url];
}, Math.random()*1000);
}
});
cc.loader.register(["_test2"], {
load: function(realUrl, url, res, cb){
cb && cb({});
return null;
}
});
},
list: [
"1._test2",
"1._test1",
"2._test1",
"3._test1",
"4._test1"
],
createInfo: function(){
var winSize = cc.director.getWinSize();
var info1 = new cc.LabelTTF("Load 5 files");
info1.x = winSize.width / 2;
info1.y = winSize.height / 2 + 80;
var info2 = new cc.LabelTTF("1 file does not exist");
info2.x = winSize.width / 2;
info2.y = winSize.height / 2 + 60;
var info3 = new cc.LabelTTF("The other 4 files should be loaded.");
info3.x = winSize.width / 2;
info3.y = winSize.height / 2 + 40;
this.addChild(info1);
this.addChild(info2);
this.addChild(info3);
var info4 = new cc.LabelTTF("test 1");
info4.x = winSize.width / 2 - 50;
info4.y = winSize.height / 2;
var info5 = new cc.LabelTTF("test 2");
info5.x = winSize.width / 2 - 150;
info5.y = winSize.height / 2;
var info6 = new cc.LabelTTF("test 3");
info6.x = winSize.width / 2 + 50;
info6.y = winSize.height / 2;
var info7 = new cc.LabelTTF("test 4");
info7.x = winSize.width / 2 + 150;
info7.y = winSize.height / 2;
this.addChild(info4);
this.addChild(info5);
this.addChild(info6);
this.addChild(info7);
},
test: function(cb){
this.clearRes();
var layer = this;
cc.loader.load(layer.list, function(){
var num = 0;
layer.list.forEach(function(item){
if(!cc.loader.getRes(item)){
num++;
}
});
cb(num);
});
},
clearRes: function(){
this.list.forEach(function(item){
cc.loader.release(item);
});
},
onRestartCallback: function(){
var parent = this._parent;
parent.removeChild(this);
parent.addChild(new LoaderCycleLayer());
},
onBackCallback: function(){
var parent = this._parent;
parent.removeChild(this);
parent.addChild(new LoaderTestLayer());
}
});