Merge pull request #12737 from chengstory/FixReaderBug

Fix cocos reader bug.
This commit is contained in:
pandamicro 2015-07-09 10:33:45 +08:00
commit 893d39c543
2 changed files with 14 additions and 20 deletions

View File

@ -238,15 +238,12 @@ namespace cocostudio
setPropsWithFlatBuffers(tmx, (Table*)gameMapOptions);
}
}
//else
//{
// Node* node = Node::create();
// setPropsWithFlatBuffers(node, (Table*)gameMapOptions);
// auto label = Label::create();
// label->setString(__String::createWithFormat("%s missed", errorFilePath.c_str())->getCString());
// node->addChild(label);
// return node;
//}
else
{
Node* node = Node::create();
setPropsWithFlatBuffers(node, (Table*)gameMapOptions);
return node;
}
return tmx;
}

View File

@ -153,11 +153,11 @@ namespace cocostudio
void ParticleReader::setPropsWithFlatBuffers(cocos2d::Node *node,
const flatbuffers::Table *particleOptions)
{
auto particle = static_cast<ParticleSystemQuad*>(node);
auto particle = dynamic_cast<ParticleSystemQuad*>(node);
auto options = (ParticleSystemOptions*)particleOptions;
auto f_blendFunc = options->blendFunc();
if (f_blendFunc)
if (particle && f_blendFunc)
{
cocos2d::BlendFunc blendFunc = cocos2d::BlendFunc::ALPHA_PREMULTIPLIED;
blendFunc.src = f_blendFunc->src();
@ -208,15 +208,12 @@ namespace cocostudio
particle->setPositionType(ParticleSystem::PositionType::GROUPED);
}
}
//else
//{
// Node* node = Node::create();
// setPropsWithFlatBuffers(node, (Table*)particleOptions);
// auto label = Label::create();
// label->setString(__String::createWithFormat("%s missed", errorFilePath.c_str())->getCString());
// node->addChild(label);
// return node;
//}
else
{
Node* node = Node::create();
setPropsWithFlatBuffers(node, (Table*)particleOptions);
return node;
}
return particle;
}