Update that parse resource path with flat buffers for readers

This commit is contained in:
pipu 2014-12-22 13:42:18 +08:00
parent 92584bbc7f
commit 0c6e22dd77
9 changed files with 30 additions and 18 deletions

View File

@ -835,6 +835,12 @@ Node* CSLoader::nodeWithFlatBuffers(const flatbuffers::NodeTree *nodetree)
// _loadingNodeParentHierarchy.push_back(node);
}
// If node is invalid, there is no necessity to process children of node.
if (!node)
{
return nullptr;
}
auto children = nodetree->children();
int size = children->size();
CCLOG("size = %d", size);
@ -1156,6 +1162,12 @@ Node* CSLoader::nodeWithFlatBuffersForSimulator(const flatbuffers::NodeTree *nod
// _loadingNodeParentHierarchy.push_back(node);
}
// If node is invalid, there is no necessity to process children of node.
if (!node)
{
return nullptr;
}
auto children = nodetree->children();
int size = children->size();
CCLOG("size = %d", size);

View File

@ -551,7 +551,7 @@ namespace cocostudio
std::string normalErrorFilePath = "";
auto normalDic = options->normalData();
int normalType = normalDic->resourceType();
std::string normalTexturePath = this->getResourcePath(normalDic->path()->c_str(), (Widget::TextureResType)normalType);
std::string normalTexturePath = normalDic->path()->c_str();
switch (normalType)
{
case 0:
@ -613,7 +613,7 @@ namespace cocostudio
std::string pressedErrorFilePath = "";
auto pressedDic = options->pressedData();
int pressedType = pressedDic->resourceType();
std::string pressedTexturePath = this->getResourcePath(pressedDic->path()->c_str(), (Widget::TextureResType)pressedType);
std::string pressedTexturePath = pressedDic->path()->c_str();
switch (pressedType)
{
case 0:
@ -677,7 +677,7 @@ namespace cocostudio
std::string disabledErrorFilePath = "";
auto disabledDic = options->disabledData();
int disabledType = disabledDic->resourceType();
std::string disabledTexturePath = this->getResourcePath(disabledDic->path()->c_str(), (Widget::TextureResType)disabledType);
std::string disabledTexturePath = disabledDic->path()->c_str();
switch (disabledType)
{
case 0:

View File

@ -433,7 +433,7 @@ namespace cocostudio
std::string backGroundErrorFilePath = "";
auto backGroundDic = options->backGroundBoxData();
int backGroundType = backGroundDic->resourceType();
std::string backGroundTexturePath = this->getResourcePath(backGroundDic->path()->c_str(), (Widget::TextureResType)backGroundType);
std::string backGroundTexturePath = backGroundDic->path()->c_str();
switch (backGroundType)
{
case 0:
@ -498,7 +498,7 @@ namespace cocostudio
std::string backGroundSelectedErrorFilePath = "";
auto backGroundSelectedDic = options->backGroundBoxSelectedData();
int backGroundSelectedType = backGroundSelectedDic->resourceType();
std::string backGroundSelectedTexturePath = this->getResourcePath(backGroundSelectedDic->path()->c_str(), (Widget::TextureResType)backGroundSelectedType);
std::string backGroundSelectedTexturePath = backGroundSelectedDic->path()->c_str();
switch (backGroundSelectedType)
{
case 0:
@ -563,7 +563,7 @@ namespace cocostudio
std::string frontCrossErrorFilePath = "";
auto frontCrossDic = options->frontCrossData();
int frontCrossType = frontCrossDic->resourceType();
std::string frontCrossFileName = this->getResourcePath(frontCrossDic->path()->c_str(), (Widget::TextureResType)frontCrossType);
std::string frontCrossFileName = frontCrossDic->path()->c_str();
switch (frontCrossType)
{
case 0:
@ -628,7 +628,7 @@ namespace cocostudio
std::string backGroundBoxDisabledErrorFilePath = "";
auto backGroundDisabledDic = options->backGroundBoxDisabledData();
int backGroundDisabledType = backGroundDisabledDic->resourceType();
std::string backGroundDisabledFileName = this->getResourcePath(backGroundDisabledDic->path()->c_str(), (Widget::TextureResType)backGroundDisabledType);
std::string backGroundDisabledFileName = backGroundDisabledDic->path()->c_str();
switch (backGroundDisabledType)
{
case 0:
@ -693,7 +693,7 @@ namespace cocostudio
std::string frontCrossDisabledErrorFilePath = "";
auto frontCrossDisabledDic = options->frontCrossDisabledData();
int frontCrossDisabledType = frontCrossDisabledDic->resourceType();
std::string frontCrossDisabledFileName = this->getResourcePath(frontCrossDisabledDic->path()->c_str(), (Widget::TextureResType)frontCrossDisabledType);
std::string frontCrossDisabledFileName = frontCrossDisabledDic->path()->c_str();
switch (frontCrossDisabledType)
{
case 0:

View File

@ -295,7 +295,7 @@ namespace cocostudio
std::string errorFilePath = "";
auto imageFileNameDic = options->fileNameData();
int imageFileNameType = imageFileNameDic->resourceType();
std::string imageFileName = this->getResourcePath(imageFileNameDic->path()->c_str(), (Widget::TextureResType)imageFileNameType);
std::string imageFileName = imageFileNameDic->path()->c_str();
switch (imageFileNameType)
{
case 0:

View File

@ -602,7 +602,7 @@ namespace cocostudio
std::string errorFilePath = "";
auto imageFileNameDic = options->backGroundImageData();
int imageFileNameType = imageFileNameDic->resourceType();
std::string imageFileName = this->getResourcePath(imageFileNameDic->path()->c_str(), (Widget::TextureResType)imageFileNameType);
std::string imageFileName = imageFileNameDic->path()->c_str();
if (imageFileName != "")
{
switch (imageFileNameType)

View File

@ -245,7 +245,7 @@ namespace cocostudio
std::string errorFilePath = "";
auto imageFileNameDic = options->textureData();
int imageFileNameType = imageFileNameDic->resourceType();
std::string imageFileName = this->getResourcePath(imageFileNameDic->path()->c_str(), (Widget::TextureResType)imageFileNameType);
std::string imageFileName = imageFileNameDic->path()->c_str();
switch (imageFileNameType)
{
case 0:

View File

@ -343,7 +343,7 @@ namespace cocostudio
std::string errorFilePath = "";
auto imageFileNameDic = options->backGroundImageData();
int imageFileNameType = imageFileNameDic->resourceType();
std::string imageFileName = this->getResourcePath(imageFileNameDic->path()->c_str(), (Widget::TextureResType)imageFileNameType);
std::string imageFileName = imageFileNameDic->path()->c_str();
if (imageFileName != "")
{
switch (imageFileNameType)

View File

@ -429,7 +429,7 @@ namespace cocostudio
std::string errorFilePath = "";
auto imageFileNameDic = options->backGroundImageData();
int imageFileNameType = imageFileNameDic->resourceType();
std::string imageFileName = this->getResourcePath(imageFileNameDic->path()->c_str(), (Widget::TextureResType)imageFileNameType);
std::string imageFileName = imageFileNameDic->path()->c_str();
if (imageFileName != "")
{
switch (imageFileNameType)

View File

@ -467,7 +467,7 @@ namespace cocostudio
std::string imageErrorFilePath = "";
auto imageFileNameDic = options->barFileNameData();
int imageFileNameType = imageFileNameDic->resourceType();
std::string imageFileName = this->getResourcePath(imageFileNameDic->path()->c_str(), (Widget::TextureResType)imageFileNameType);
std::string imageFileName = imageFileNameDic->path()->c_str();
switch (imageFileNameType)
{
case 0:
@ -532,7 +532,7 @@ namespace cocostudio
std::string normalErrorFilePath = "";
auto normalDic = options->ballNormalData();
int normalType = normalDic->resourceType();
std::string normalFileName = this->getResourcePath(normalDic->path()->c_str(), (Widget::TextureResType)normalType);
std::string normalFileName = normalDic->path()->c_str();
switch (normalType)
{
case 0:
@ -597,7 +597,7 @@ namespace cocostudio
std::string pressedErrorFilePath = "";
auto pressedDic = options->ballPressedData();
int pressedType = pressedDic->resourceType();
std::string pressedFileName = this->getResourcePath(pressedDic->path()->c_str(), (Widget::TextureResType)pressedType);
std::string pressedFileName = pressedDic->path()->c_str();
switch (pressedType)
{
case 0:
@ -662,7 +662,7 @@ namespace cocostudio
std::string disabledErrorFilePath = "";
auto disabledDic = options->ballDisabledData();
int disabledType = disabledDic->resourceType();
std::string disabledFileName = this->getResourcePath(disabledDic->path()->c_str(), (Widget::TextureResType)disabledType);
std::string disabledFileName = disabledDic->path()->c_str();
switch (disabledType)
{
case 0:
@ -727,7 +727,7 @@ namespace cocostudio
std::string progressErrorFilePath = "";
auto progressBarDic = options->progressBarData();
int progressBarType = progressBarDic->resourceType();
std::string progressBarFileName = this->getResourcePath(progressBarDic->path()->c_str(), (Widget::TextureResType)progressBarType);
std::string progressBarFileName = progressBarDic->path()->c_str();
switch (progressBarType)
{
case 0: