1. merge v3

This commit is contained in:
zhangcheng 2014-07-02 15:37:15 +08:00
commit 9204ac28df
31 changed files with 516 additions and 497 deletions

View File

@ -83,7 +83,7 @@ void ActionManagerEx::initWithDictionary(const char* jsonName,const rapidjson::V
CCLOG("filename == %s",fileName.c_str());
cocos2d::Vector<ActionObject*> actionList;
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
stExpCocoNode *stChildArray = pCocoNode->GetChildArray(cocoLoader);
stExpCocoNode *actionNode = nullptr;
for (int i=0; i < pCocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(cocoLoader);
@ -99,7 +99,7 @@ void ActionManagerEx::initWithDictionary(const char* jsonName,const rapidjson::V
ActionObject* action = new ActionObject();
action->autorelease();
action->initWithBinary(cocoLoader, actionNode->GetChildArray(), root);
action->initWithBinary(cocoLoader, actionNode->GetChildArray(cocoLoader), root);
actionList.pushBack(action);
}

View File

@ -195,11 +195,11 @@ void ActionNode::initWithDictionary(const rapidjson::Value& dic, Ref* root)
stExpCocoNode *stChildNode = cocoNode;
int actionNodeCount = stChildNode->GetChildNum();
stChildNode = stChildNode[0].GetChildArray();
stChildNode = stChildNode[0].GetChildArray(cocoLoader);
stExpCocoNode *frameListNode = nullptr;
for (int i = 0; i < actionNodeCount; ++i) {
std::string key = stChildNode[i].GetName(cocoLoader);
std::string value = stChildNode[i].GetValue();
std::string value = stChildNode[i].GetValue(cocoLoader);
if (key == "ActionTag") {
setActionTag(valueToInt(value));
}else if (key == "actionframelist"){
@ -208,7 +208,7 @@ void ActionNode::initWithDictionary(const rapidjson::Value& dic, Ref* root)
}
int actionFrameCount = frameListNode->GetChildNum();
stExpCocoNode *stFrameChildNode = frameListNode->GetChildArray();
stExpCocoNode *stFrameChildNode = frameListNode->GetChildArray(cocoLoader);
for (int i=0; i<actionFrameCount; i++) {
int frameIndex;
@ -225,10 +225,10 @@ void ActionNode::initWithDictionary(const rapidjson::Value& dic, Ref* root)
std::vector<float> frameTweenParameter;
int framesCount = stFrameChildNode[i].GetChildNum();
stExpCocoNode *innerFrameNode = stFrameChildNode[i].GetChildArray();
stExpCocoNode *innerFrameNode = stFrameChildNode[i].GetChildArray(cocoLoader);
for (int j = 0; j < framesCount; j++) {
std::string key = innerFrameNode[j].GetName(cocoLoader);
std::string value = innerFrameNode[j].GetValue();
std::string value = innerFrameNode[j].GetValue(cocoLoader);
if (key == "frameid") {
frameIndex = valueToInt(value);
@ -237,10 +237,10 @@ void ActionNode::initWithDictionary(const rapidjson::Value& dic, Ref* root)
}else if (key == "tweenParameter"){
// There are no tweenParameter args in the json file
int tweenParameterCount = innerFrameNode[j].GetChildNum();
stExpCocoNode *tweenParameterArray = innerFrameNode[j].GetChildArray();
stExpCocoNode *tweenParameterArray = innerFrameNode[j].GetChildArray(cocoLoader);
for (int k = 0; k < tweenParameterCount; ++k) {
std::string t_key = tweenParameterArray[j].GetName(cocoLoader);
std::string t_value = tweenParameterArray[j].GetValue();
std::string t_value = tweenParameterArray[j].GetValue(cocoLoader);
frameTweenParameter.push_back(valueToFloat(t_value));
}
}else if (key == "positionx"){

View File

@ -132,12 +132,12 @@ void ActionObject::initWithBinary(CocoLoader *cocoLoader,
stExpCocoNode *cocoNode,
cocos2d::Ref *root)
{
stExpCocoNode *stChildNode = cocoNode->GetChildArray();
stExpCocoNode *stChildNode = cocoNode->GetChildArray(cocoLoader);
stExpCocoNode *actionNodeList = nullptr;
int count = cocoNode->GetChildNum();
for (int i = 0; i < count; ++i) {
std::string key = stChildNode[i].GetName(cocoLoader);
std::string value = stChildNode[i].GetValue();
std::string value = stChildNode[i].GetValue(cocoLoader);
if (key == "name") {
setName(value.c_str());
}else if (key == "loop"){
@ -152,7 +152,7 @@ void ActionObject::initWithBinary(CocoLoader *cocoLoader,
if(nullptr != actionNodeList)
{
int actionNodeCount = actionNodeList->GetChildNum();
stExpCocoNode *actionNodeArray = actionNodeList->GetChildArray();
stExpCocoNode *actionNodeArray = actionNodeList->GetChildArray(cocoLoader);
int maxLength = 0;
for (int i=0; i<actionNodeCount; i++) {
ActionNode* actionNode = new ActionNode();

View File

@ -151,6 +151,7 @@ bool ComAttribute::serialize(void* r)
SerData *serData = (SerData *)(r);
const rapidjson::Value *v = serData->_rData;
stExpCocoNode *cocoNode = serData->_cocoNode;
CocoLoader *cocoLoader = serData->_cocoLoader;
const char *className = nullptr;
const char *comName = nullptr;
const char *file = nullptr;
@ -170,14 +171,14 @@ bool ComAttribute::serialize(void* r)
}
else if (cocoNode != nullptr)
{
className = cocoNode[1].GetValue();
className = cocoNode[1].GetValue(cocoLoader);
CC_BREAK_IF(className == nullptr);
comName = cocoNode[2].GetValue();
stExpCocoNode *fileData = cocoNode[3].GetChildArray();
comName = cocoNode[2].GetValue(cocoLoader);
stExpCocoNode *fileData = cocoNode[3].GetChildArray(cocoLoader);
CC_BREAK_IF(!fileData);
file = fileData[0].GetValue();
file = fileData[0].GetValue(cocoLoader);
CC_BREAK_IF(file == nullptr);
resType = atoi(fileData[2].GetValue());
resType = atoi(fileData[2].GetValue(cocoLoader));
CC_BREAK_IF(resType != 0);
}
if (comName != nullptr)

View File

@ -76,6 +76,7 @@ bool ComAudio::serialize(void* r)
SerData *serData = (SerData *)(r);
const rapidjson::Value *v = serData->_rData;
stExpCocoNode *cocoNode = serData->_cocoNode;
CocoLoader *cocoLoader = serData->_cocoLoader;
const char *className = nullptr;
const char *comName = nullptr;
const char *file = nullptr;
@ -97,16 +98,16 @@ bool ComAudio::serialize(void* r)
}
else if (cocoNode != nullptr)
{
className = cocoNode[1].GetValue();
className = cocoNode[1].GetValue(cocoLoader);
CC_BREAK_IF(className == nullptr);
comName = cocoNode[2].GetValue();
stExpCocoNode *pfileData = cocoNode[4].GetChildArray();
comName = cocoNode[2].GetValue(cocoLoader);
stExpCocoNode *pfileData = cocoNode[4].GetChildArray(cocoLoader);
CC_BREAK_IF(!pfileData);
file = pfileData[0].GetValue();
file = pfileData[0].GetValue(cocoLoader);
CC_BREAK_IF(file == nullptr);
resType = atoi(pfileData[2].GetValue());
resType = atoi(pfileData[2].GetValue(cocoLoader));
CC_BREAK_IF(resType != 0);
loop = atoi(cocoNode[5].GetValue()) != 0? true:false;
loop = atoi(cocoNode[5].GetValue(cocoLoader)) != 0? true:false;
ret = true;
}
if (comName != nullptr)

View File

@ -50,10 +50,12 @@ struct SerData
{
const rapidjson::Value *_rData;
cocostudio::stExpCocoNode *_cocoNode;
cocostudio::CocoLoader *_cocoLoader;
SerData()
{
_rData = NULL;
_cocoNode = NULL;
_cocoLoader = NULL;
}
};

View File

@ -97,6 +97,7 @@ bool ComRender::serialize(void* r)
SerData *serData = (SerData *)(r);
const rapidjson::Value *v = serData->_rData;
stExpCocoNode *cocoNode = serData->_cocoNode;
CocoLoader *cocoLoader = serData->_cocoLoader;
const char *className = nullptr;
const char *comName = nullptr;
const char *file = nullptr;
@ -118,15 +119,15 @@ bool ComRender::serialize(void* r)
}
else if(cocoNode != nullptr)
{
className = cocoNode[1].GetValue();
className = cocoNode[1].GetValue(cocoLoader);
CC_BREAK_IF(className == nullptr);
comName = cocoNode[2].GetValue();
stExpCocoNode *pfileData = cocoNode[4].GetChildArray();
comName = cocoNode[2].GetValue(cocoLoader);
stExpCocoNode *pfileData = cocoNode[4].GetChildArray(cocoLoader);
CC_BREAK_IF(!pfileData);
file = pfileData[0].GetValue();
plist = pfileData[1].GetValue();
file = pfileData[0].GetValue(cocoLoader);
plist = pfileData[1].GetValue(cocoLoader);
CC_BREAK_IF(file == nullptr && plist == nullptr);
resType = atoi(pfileData[2].GetValue());
resType = atoi(pfileData[2].GetValue(cocoLoader));
}
if (comName != nullptr)
{
@ -195,7 +196,7 @@ bool ComRender::serialize(void* r)
const char *actionName = nullptr;
if (cocoNode != nullptr)
{
actionName = cocoNode[6].GetValue();//DICTOOL->getStringValue_json(*v, "selectedactionname");
actionName = cocoNode[6].GetValue(cocoLoader);//DICTOOL->getStringValue_json(*v, "selectedactionname");
}
else
{
@ -222,25 +223,25 @@ bool ComRender::serialize(void* r)
if (rapidjson::kObjectType == tType)
{
int count = tpRootCocoNode->GetChildNum();
stExpCocoNode *tpChildArray = tpRootCocoNode->GetChildArray();
stExpCocoNode *tpChildArray = tpRootCocoNode->GetChildArray(&tCocoLoader);
for (int i = 0; i < count; ++i)
{
std::string key = tpChildArray[i].GetName(&tCocoLoader);
if (key.compare("armature_data") == 0)
{
int length = tpChildArray[i].GetChildNum();
stExpCocoNode *armature_dataArray = tpChildArray[i].GetChildArray();
stExpCocoNode *armature_dataArray = tpChildArray[i].GetChildArray(&tCocoLoader);
if (length < 1)
{
continue;
}
length = armature_dataArray[0].GetChildNum();
stExpCocoNode *armature_data = armature_dataArray[0].GetChildArray();
stExpCocoNode *armature_data = armature_dataArray[0].GetChildArray(&tCocoLoader);
for (int j = 0; j < length; ++j)
{
std::string key1 = armature_data[j].GetName(&tCocoLoader);
const char *str1 = armature_data[j].GetValue();
const char *str1 = armature_data[j].GetValue(&tCocoLoader);
if (key.compare("name") == 0)
{
if (str1 != nullptr)
@ -252,7 +253,7 @@ bool ComRender::serialize(void* r)
const char *actionName = nullptr;
if (cocoNode != nullptr)
{
actionName = cocoNode[6].GetValue();
actionName = cocoNode[6].GetValue(&tCocoLoader);
}
else
{

View File

@ -301,9 +301,9 @@ void DataReaderHelper::addDataFromFile(const std::string& filePath)
// Read content from file
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(filePath);
bool isbinarysrc = str==".csb";
bool isbinaryfilesrc = str==".csb";
std::string filemode("r");
if(isbinarysrc)
if(isbinaryfilesrc)
filemode += "b";
ssize_t filesize;
@ -324,7 +324,7 @@ void DataReaderHelper::addDataFromFile(const std::string& filePath)
{
DataReaderHelper::addDataFromJsonCache(contentStr, &dataInfo);
}
else if(str == ".csb")
else if(isbinaryfilesrc)
{
DataReaderHelper::addDataFromBinaryCache(contentStr.c_str(),&dataInfo);
}
@ -438,7 +438,7 @@ void DataReaderHelper::addDataFromFileAsync(const std::string& imagePath, const
{
data->configType = CocoStudio_JSON;
}
else if(str == ".csb")
else if(isbinaryfilesrc)
{
data->configType = CocoStudio_Binary;
}
@ -1750,7 +1750,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
rapidjson::Type tType = tpRootCocoNode->GetType(&tCocoLoader);
if (rapidjson::kObjectType == tType)
{
stExpCocoNode *tpChildArray = tpRootCocoNode->GetChildArray();
stExpCocoNode *tpChildArray = tpRootCocoNode->GetChildArray(&tCocoLoader);
int nCount = tpRootCocoNode->GetChildNum();
dataInfo->contentScale = 1.0f;
@ -1762,12 +1762,12 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
key = tpChildArray[i].GetName(&tCocoLoader);
if (key.compare(CONTENT_SCALE) == 0)
{
std::string value = tpChildArray[i].GetValue();
std::string value = tpChildArray[i].GetValue(&tCocoLoader);
dataInfo->contentScale = atof(value.c_str());
}
else if ( 0 == key.compare(ARMATURE_DATA))
{
pDataArray = tpChildArray[i].GetChildArray();
pDataArray = tpChildArray[i].GetChildArray(&tCocoLoader);
length = tpChildArray[i].GetChildNum();
ArmatureData * armatureData;
for (int ii = 0; ii < length; ++ii)
@ -1787,7 +1787,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
}
else if ( 0 == key.compare(ANIMATION_DATA))
{
pDataArray = tpChildArray[i].GetChildArray();
pDataArray = tpChildArray[i].GetChildArray(&tCocoLoader);
length = tpChildArray[i].GetChildNum();
AnimationData *animationData;
for (int ii = 0; ii < length; ++ii)
@ -1807,7 +1807,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
}
else if (key.compare(TEXTURE_DATA) == 0)
{
pDataArray = tpChildArray[i].GetChildArray();
pDataArray = tpChildArray[i].GetChildArray(&tCocoLoader);
length = tpChildArray[i].GetChildNum();
for (int ii = 0; ii < length; ++ii)
{
@ -1837,10 +1837,10 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
continue;
}
length = tpChildArray[i].GetChildNum();
stExpCocoNode *pConfigFilePath = tpChildArray[i].GetChildArray();
stExpCocoNode *pConfigFilePath = tpChildArray[i].GetChildArray(&tCocoLoader);
for (int ii = 0; ii < length; ii++)
{
const char *path = pConfigFilePath[ii].GetValue();
const char *path = pConfigFilePath[ii].GetValue(&tCocoLoader);
if (path == nullptr)
{
CCLOG("load CONFIG_FILE_PATH error.");
@ -1872,18 +1872,18 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
{
ArmatureData *armatureData = new ArmatureData();
armatureData->init();
stExpCocoNode *pAramtureDataArray = cocoNode->GetChildArray();
const char *name = pAramtureDataArray[2].GetValue(); //DICTOOL->getStringValue_json(json, A_NAME);
stExpCocoNode *pAramtureDataArray = cocoNode->GetChildArray(cocoLoader);
const char *name = pAramtureDataArray[2].GetValue(cocoLoader); //DICTOOL->getStringValue_json(json, A_NAME);
if(name != nullptr)
{
armatureData->name = name;
}
float version = atof(pAramtureDataArray[1].GetValue());
float version = atof(pAramtureDataArray[1].GetValue(cocoLoader));
dataInfo->cocoStudioVersion = armatureData->dataVersion = version; //DICTOOL->getFloatValue_json(json, VERSION, 0.1f);
int length = pAramtureDataArray[3].GetChildNum(); //DICTOOL->getArrayCount_json(json, BONE_DATA, 0);
stExpCocoNode *pBoneChildren = pAramtureDataArray[3].GetChildArray();
stExpCocoNode *pBoneChildren = pAramtureDataArray[3].GetChildArray(cocoLoader);
stExpCocoNode* child;
for (int i = 0; i < length; i++)
{
@ -1905,7 +1905,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
decodeNode(boneData, cocoLoader, cocoNode, dataInfo);
int length = cocoNode->GetChildNum();
stExpCocoNode *pBoneChildren = cocoNode->GetChildArray();
stExpCocoNode *pBoneChildren = cocoNode->GetChildArray(cocoLoader);
stExpCocoNode* child;
const char *str = nullptr;
std::string key;
@ -1913,7 +1913,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
{
child = &pBoneChildren[i];
key = child->GetName(cocoLoader);
str = child->GetValue();
str = child->GetValue(cocoLoader);
if (key.compare(A_NAME) == 0)
{
//DICTOOL->getStringValue_json(json, A_NAME);
@ -1933,7 +1933,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
else if (key.compare(DISPLAY_DATA) == 0)
{
int count = child->GetChildNum();
stExpCocoNode *pDisplayData = child->GetChildArray();
stExpCocoNode *pDisplayData = child->GetChildArray(cocoLoader);
for (int ii = 0; ii < count; ++ii)
{
DisplayData *displayData = decodeBoneDisplay(cocoLoader, &pDisplayData[ii], dataInfo);
@ -1950,16 +1950,16 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
DisplayData* DataReaderHelper::decodeBoneDisplay(CocoLoader *cocoLoader, stExpCocoNode *cocoNode, DataInfo *dataInfo)
{
stExpCocoNode* children = cocoNode->GetChildArray();
stExpCocoNode* children = cocoNode->GetChildArray(cocoLoader);
stExpCocoNode* child = &children[1];
const char *str = nullptr;
std::string key = child->GetName(cocoLoader);
str = child->GetValue();
str = child->GetValue(cocoLoader);
DisplayData *displayData = nullptr;
if (key.compare(A_DISPLAY_TYPE) == 0)
{
str = child->GetValue();
str = child->GetValue(cocoLoader);
DisplayType displayType = (DisplayType)(atoi(str));
int length = 0;
@ -1969,12 +1969,12 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
{
displayData = new SpriteDisplayData();
const char *name = children[0].GetValue();
const char *name = children[0].GetValue(cocoLoader);
if(name != nullptr)
{
((SpriteDisplayData *)displayData)->displayName = name;
}
stExpCocoNode *pSkinDataArray = children[2].GetChildArray();
stExpCocoNode *pSkinDataArray = children[2].GetChildArray(cocoLoader);
if (pSkinDataArray != nullptr)
{
stExpCocoNode *pSkinData = &pSkinDataArray[0];
@ -1982,11 +1982,11 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
{
SpriteDisplayData *sdd = (SpriteDisplayData *)displayData;
length = pSkinData->GetChildNum();
stExpCocoNode *SkinDataValue = pSkinData->GetChildArray();
stExpCocoNode *SkinDataValue = pSkinData->GetChildArray(cocoLoader);
for (int i = 0; i < length; ++i)
{
key = SkinDataValue[i].GetName(cocoLoader);
str = SkinDataValue[i].GetValue();
str = SkinDataValue[i].GetValue(cocoLoader);
if (key.compare(A_X) == 0)
{
sdd->skinData.x = atof(str) * s_PositionReadScale;
@ -2024,7 +2024,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
{
displayData = new ArmatureDisplayData();
const char *name = cocoNode[0].GetValue();
const char *name = cocoNode[0].GetValue(cocoLoader);
if(name != nullptr)
{
((ArmatureDisplayData *)displayData)->displayName = name;
@ -2035,11 +2035,11 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
{
displayData = new ParticleDisplayData();
length = cocoNode->GetChildNum();
stExpCocoNode *pDisplayData = cocoNode->GetChildArray();
stExpCocoNode *pDisplayData = cocoNode->GetChildArray(cocoLoader);
for (int i = 0; i < length; ++i)
{
key = pDisplayData[i].GetName(cocoLoader);
str = pDisplayData[i].GetValue();
str = pDisplayData[i].GetValue(cocoLoader);
if (key.compare(A_PLIST) == 0)
{
const char *plist = str;
@ -2073,7 +2073,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
AnimationData *aniData = new AnimationData();
int length = cocoNode->GetChildNum();
stExpCocoNode *pAnimationData = cocoNode->GetChildArray();
stExpCocoNode *pAnimationData = cocoNode->GetChildArray(cocoLoader);
const char *str = nullptr;
std::string key;
stExpCocoNode* child;
@ -2082,7 +2082,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
{
child = &pAnimationData[i];
key = child->GetName(cocoLoader);
str = child->GetValue();
str = child->GetValue(cocoLoader);
if (key.compare(A_NAME) == 0)
{
if(str != nullptr)
@ -2093,7 +2093,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
else if (key.compare(MOVEMENT_DATA) == 0)
{
int movcount = child->GetChildNum();
stExpCocoNode* movArray = child->GetChildArray();
stExpCocoNode* movArray = child->GetChildArray(cocoLoader);
for( int movnum =0; movnum <movcount; movnum++)
{
movementData = decodeMovement(cocoLoader, &movArray[movnum], dataInfo);
@ -2111,7 +2111,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
movementData->scale = 1.0f;
int length = cocoNode->GetChildNum();
stExpCocoNode *pMoveDataArray = cocoNode->GetChildArray();
stExpCocoNode *pMoveDataArray = cocoNode->GetChildArray(cocoLoader);
const char *str = nullptr;
std::string key;
@ -2120,7 +2120,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
{
child = &pMoveDataArray[i];
key = child->GetName(cocoLoader);
str = child->GetValue();
str = child->GetValue(cocoLoader);
if (key.compare(A_NAME) == 0)
{
if(str != nullptr)
@ -2182,7 +2182,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
else if (key.compare(MOVEMENT_BONE_DATA) == 0)
{
int count = child->GetChildNum();
stExpCocoNode *pMoveBoneData = child->GetChildArray();
stExpCocoNode *pMoveBoneData = child->GetChildArray(cocoLoader);
MovementBoneData *movementBoneData;
for (int ii = 0; ii < count; ++ii)
{
@ -2201,14 +2201,14 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
movementBoneData->init();
int length = cocoNode->GetChildNum();
stExpCocoNode *pMovementBoneDataArray = cocoNode->GetChildArray();
stExpCocoNode *pMovementBoneDataArray = cocoNode->GetChildArray(cocoLoader);
stExpCocoNode* movebonechild;
const char *str = nullptr;
for (int i = 0; i < length; ++i)
{
movebonechild = &pMovementBoneDataArray[i];
std::string key = movebonechild->GetName(cocoLoader);
str = movebonechild->GetValue();
str = movebonechild->GetValue(cocoLoader);
if (key.compare(A_NAME) == 0)
{
if(str != nullptr)
@ -2226,7 +2226,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
else if (key.compare(FRAME_DATA) == 0)
{
int count =movebonechild->GetChildNum();
stExpCocoNode *pFrameDataArray = movebonechild->GetChildArray();
stExpCocoNode *pFrameDataArray = movebonechild->GetChildArray(cocoLoader);
for (int ii = 0; ii < count; ++ii)
{
FrameData *frameData = decodeFrame(cocoLoader, &pFrameDataArray[ii], dataInfo);
@ -2296,12 +2296,12 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
decodeNode(frameData, cocoLoader, cocoNode, dataInfo);
int length = cocoNode->GetChildNum();
stExpCocoNode *pFrameDataArray = cocoNode->GetChildArray();
stExpCocoNode *pFrameDataArray = cocoNode->GetChildArray(cocoLoader);
const char *str = nullptr;
for (int i = 0; i < length; ++i)
{
std::string key = pFrameDataArray[i].GetName(cocoLoader);
str = pFrameDataArray[i].GetValue();
str = pFrameDataArray[i].GetValue(cocoLoader);
if (key.compare(A_TWEEN_EASING) == 0)
{
frameData->tweenEasing = cocos2d::tweenfunc::Linear;
@ -2376,10 +2376,10 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
if (count != 0 )
{
frameData->easingParams = new float[count];
stExpCocoNode *pFrameData = pFrameDataArray[i].GetChildArray();
stExpCocoNode *pFrameData = pFrameDataArray[i].GetChildArray(cocoLoader);
for (int ii = 0; ii < count; ++ii)
{
str = pFrameData[ii].GetValue();
str = pFrameData[ii].GetValue(cocoLoader);
if (str != nullptr)
{
frameData->easingParams[ii] = atof(str);
@ -2404,12 +2404,12 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
}
int length = cocoNode->GetChildNum();
stExpCocoNode *pTextureDataArray = cocoNode->GetChildArray();
stExpCocoNode *pTextureDataArray = cocoNode->GetChildArray(cocoLoader);
const char *str = nullptr;
for (int i = 0; i < length; ++i)
{
std::string key = pTextureDataArray[i].GetName(cocoLoader);
str = pTextureDataArray[i].GetValue();
str = pTextureDataArray[i].GetValue(cocoLoader);
if (key.compare(A_NAME) == 0)
{
if(str != nullptr)
@ -2448,7 +2448,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
else if (key.compare(CONTOUR_DATA) == 0)
{
int count = pTextureDataArray[i].GetChildNum();
stExpCocoNode *pContourArray = pTextureDataArray[i].GetChildArray();
stExpCocoNode *pContourArray = pTextureDataArray[i].GetChildArray(cocoLoader);
for (int ii = 0; ii < count; ++ii)
{
ContourData *contourData = decodeContour(cocoLoader, &pContourArray[ii]);
@ -2466,23 +2466,23 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
contourData->init();
int length = cocoNode->GetChildNum();
stExpCocoNode *verTexPointArray = cocoNode->GetChildArray();
stExpCocoNode *verTexPointArray = cocoNode->GetChildArray(cocoLoader);
const char *str = nullptr;
for (int i = 0; i < length; ++i)
{
std::string key = verTexPointArray[i].GetName(cocoLoader);
str = verTexPointArray[i].GetValue();
str = verTexPointArray[i].GetValue(cocoLoader);
if (key.compare(VERTEX_POINT) == 0)
{
int count = verTexPointArray[i].GetChildNum();
stExpCocoNode *pVerTexPointArray = verTexPointArray[i].GetChildArray();
stExpCocoNode *pVerTexPointArray = verTexPointArray[i].GetChildArray(cocoLoader);
stExpCocoNode *pVerTexPoint;
for (int ii = count - 1; ii >= 0; --ii)
{
pVerTexPoint = pVerTexPointArray[ii].GetChildArray();
pVerTexPoint = pVerTexPointArray[ii].GetChildArray(cocoLoader);
Vec2 vertex;
vertex.x = atof(pVerTexPoint[0].GetValue());
vertex.y = atof(pVerTexPoint[1].GetValue());
vertex.x = atof(pVerTexPoint[0].GetValue(cocoLoader));
vertex.y = atof(pVerTexPoint[1].GetValue(cocoLoader));
contourData->vertexList.push_back(vertex); }
break;
}
@ -2493,7 +2493,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
void DataReaderHelper::decodeNode(BaseData *node, CocoLoader *cocoLoader, stExpCocoNode* cocoNode, DataInfo *dataInfo)
{
int length = cocoNode->GetChildNum();
stExpCocoNode *NodeArray = cocoNode->GetChildArray();
stExpCocoNode *NodeArray = cocoNode->GetChildArray(cocoLoader);
const char *str = nullptr;
bool isVersionL = dataInfo->cocoStudioVersion < VERSION_COLOR_READING;
@ -2502,7 +2502,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
{
child = &NodeArray[i];
std::string key = child->GetName(cocoLoader);
str = child->GetValue();
str = child->GetValue(cocoLoader);
if (key.compare(A_X) == 0)
{
node->x = atof(str) * dataInfo->contentScale;
@ -2539,12 +2539,12 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
{
if(child->GetChildNum() == 4)
{
stExpCocoNode *ChildArray = child->GetChildArray();
stExpCocoNode *ChildArray = child->GetChildArray(cocoLoader);
node->a = atoi(ChildArray[0].GetValue());
node->r = atoi(ChildArray[1].GetValue());
node->g = atoi(ChildArray[2].GetValue());
node->b = atoi(ChildArray[3].GetValue());
node->a = atoi(ChildArray[0].GetValue(cocoLoader));
node->r = atoi(ChildArray[1].GetValue(cocoLoader));
node->g = atoi(ChildArray[2].GetValue(cocoLoader));
node->b = atoi(ChildArray[3].GetValue(cocoLoader));
}
}
@ -2566,12 +2566,12 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
{
if(NodeArray[0].GetChildNum() == 4)
{
stExpCocoNode *ChildArray = NodeArray[0].GetChildArray();
stExpCocoNode *ChildArray = NodeArray[0].GetChildArray(cocoLoader);
node->a = atoi(ChildArray[0].GetValue());
node->r = atoi(ChildArray[1].GetValue());
node->g = atoi(ChildArray[2].GetValue());
node->b = atoi(ChildArray[3].GetValue());
node->a = atoi(ChildArray[0].GetValue(cocoLoader));
node->r = atoi(ChildArray[1].GetValue(cocoLoader));
node->g = atoi(ChildArray[2].GetValue(cocoLoader));
node->b = atoi(ChildArray[3].GetValue(cocoLoader));
}
}

View File

@ -361,13 +361,13 @@ Widget* GUIReader::widgetFromBinaryFile(const char *fileName)
rapidjson::Type tType = tpRootCocoNode->GetType(&tCocoLoader);
if (rapidjson::kObjectType == tType || rapidjson::kArrayType == tType)
{
stExpCocoNode *tpChildArray = tpRootCocoNode->GetChildArray();
stExpCocoNode *tpChildArray = tpRootCocoNode->GetChildArray(&tCocoLoader);
for (int i = 0; i < tpRootCocoNode->GetChildNum(); ++i) {
std::string key = tpChildArray[i].GetName(&tCocoLoader);
if (key == "version") {
fileVersion = tpChildArray[i].GetValue();
fileVersion = tpChildArray[i].GetValue(&tCocoLoader);
break;
}
}
@ -1222,7 +1222,7 @@ Widget* WidgetPropertiesReader0300::createWidget(const rapidjson::Value& data, c
cocos2d::ui::Widget* WidgetPropertiesReader0300::createWidgetFromBinary(CocoLoader* cocoLoader,stExpCocoNode* cocoNode, const char* fileName)
{
stExpCocoNode *tpChildArray = cocoNode->GetChildArray();
stExpCocoNode *tpChildArray = cocoNode->GetChildArray(cocoLoader);
float fileDesignWidth;
float fileDesignHeight;
@ -1236,14 +1236,14 @@ Widget* WidgetPropertiesReader0300::createWidget(const rapidjson::Value& data, c
for (int j=0; j<texturesCount; j++)
{
std::string file;
stExpCocoNode *textureCountsArray = tpChildArray[i].GetChildArray();
file = textureCountsArray[j].GetValue();
stExpCocoNode *textureCountsArray = tpChildArray[i].GetChildArray(cocoLoader);
file = textureCountsArray[j].GetValue(cocoLoader);
SpriteFrameCache::getInstance()->addSpriteFramesWithFile(file);
}
}else if (key == "designWidth"){
fileDesignWidth = atof(tpChildArray[i].GetValue());
fileDesignWidth = atof(tpChildArray[i].GetValue(cocoLoader));
}else if (key == "designHeight"){
fileDesignHeight = atof(tpChildArray[i].GetValue());
fileDesignHeight = atof(tpChildArray[i].GetValue(cocoLoader));
}else if (key == "widgetTree"){
if (fileDesignWidth <= 0 || fileDesignHeight <= 0) {
@ -1275,7 +1275,7 @@ Widget* WidgetPropertiesReader0300::createWidget(const rapidjson::Value& data, c
/* ********************** */
/* ********************** */
stExpCocoNode *optionChildNode = cocoNode->GetChildArray();
stExpCocoNode *optionChildNode = cocoNode->GetChildArray(cocoLoader);
for (int k = 0; k < cocoNode->GetChildNum(); ++k) {
std::string key = optionChildNode[k].GetName(cocoLoader);
if (key == "animation") {
@ -1291,7 +1291,7 @@ Widget* WidgetPropertiesReader0300::createWidget(const rapidjson::Value& data, c
Widget* WidgetPropertiesReader0300::widgetFromBinary(CocoLoader* cocoLoader, stExpCocoNode* cocoNode)
{
Widget* widget = nullptr;
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
stExpCocoNode *stChildArray = cocoNode->GetChildArray(cocoLoader);
stExpCocoNode *optionsNode = nullptr;
stExpCocoNode *childrenNode = nullptr;
int elementCount = cocoNode->GetChildNum();
@ -1299,7 +1299,7 @@ Widget* WidgetPropertiesReader0300::widgetFromBinary(CocoLoader* cocoLoader, st
for (int i = 0; i < elementCount; ++i) {
std::string key = stChildArray[i].GetName(cocoLoader);
std::string value = stChildArray[i].GetValue();
std::string value = stChildArray[i].GetValue(cocoLoader);
if (key == "classname" )
{
@ -1341,11 +1341,11 @@ Widget* WidgetPropertiesReader0300::widgetFromBinary(CocoLoader* cocoLoader, st
// 2nd., custom widget parse with custom reader
//2nd. parse custom property
const char* customProperty = NULL;
stExpCocoNode *optionChildNode = optionsNode->GetChildArray();
stExpCocoNode *optionChildNode = optionsNode->GetChildArray(cocoLoader);
for (int k = 0; k < optionsNode->GetChildNum(); ++k) {
std::string key = optionChildNode[k].GetName(cocoLoader);
if (key == "customProperty") {
customProperty = optionChildNode[k].GetValue();
customProperty = optionChildNode[k].GetValue(cocoLoader);
break;
}
}
@ -1369,7 +1369,7 @@ Widget* WidgetPropertiesReader0300::widgetFromBinary(CocoLoader* cocoLoader, st
if (tType22 == rapidjson::kArrayType) {
int childrenCount = childrenNode->GetChildNum();
stExpCocoNode* innerChildArray = childrenNode->GetChildArray();
stExpCocoNode* innerChildArray = childrenNode->GetChildArray(cocoLoader);
for (int i=0; i < childrenCount; ++i) {
rapidjson::Type tType = innerChildArray[i].GetType(cocoLoader);

View File

@ -91,7 +91,7 @@ cocos2d::Node* SceneReader::createNodeWithSceneFile(const std::string &fileName,
rapidjson::Type tType = tpRootCocoNode->GetType(&tCocoLoader);
if (rapidjson::kObjectType == tType)
{
stExpCocoNode *tpChildArray = tpRootCocoNode->GetChildArray();
stExpCocoNode *tpChildArray = tpRootCocoNode->GetChildArray(&tCocoLoader);
CC_BREAK_IF(tpRootCocoNode->GetChildNum() == 0);
_node = Node::create();
int nCount = 0;
@ -102,17 +102,17 @@ cocos2d::Node* SceneReader::createNodeWithSceneFile(const std::string &fileName,
{
nCount = tpChildArray[15].GetChildNum();
}
stExpCocoNode *pComponents = tpChildArray[15].GetChildArray();
stExpCocoNode *pComponents = tpChildArray[15].GetChildArray(&tCocoLoader);
SerData *data = new SerData();
for (int i = 0; i < nCount; i++)
{
stExpCocoNode *subDict = pComponents[i].GetChildArray();
stExpCocoNode *subDict = pComponents[i].GetChildArray(&tCocoLoader);
if (subDict == nullptr)
{
continue;
}
std::string key1 = subDict[1].GetName(&tCocoLoader);
const char *comName = subDict[1].GetValue();
const char *comName = subDict[1].GetValue(&tCocoLoader);
Component *pCom = nullptr;
if (key1 == "classname" && comName != nullptr)
{
@ -152,7 +152,7 @@ cocos2d::Node* SceneReader::createNodeWithSceneFile(const std::string &fileName,
_node->addComponent(*iter);
}
stExpCocoNode *pGameObjects = tpChildArray[11].GetChildArray();
stExpCocoNode *pGameObjects = tpChildArray[11].GetChildArray(&tCocoLoader);
int length = tpChildArray[11].GetChildNum();
for (int i = 0; i < length; ++i)
{
@ -349,11 +349,11 @@ Node* SceneReader::createObject(const rapidjson::Value &dict, cocos2d::Node* par
cocos2d::Node* SceneReader::createObject(CocoLoader *cocoLoader, stExpCocoNode *cocoNode, cocos2d::Node* parent, AttachComponentType attachComponent)
{
const char *className = nullptr;
stExpCocoNode *pNodeArray = cocoNode->GetChildArray();
stExpCocoNode *pNodeArray = cocoNode->GetChildArray(cocoLoader);
std::string Key = pNodeArray[1].GetName(cocoLoader);
if (Key == "classname")
{
className = pNodeArray[1].GetValue();
className = pNodeArray[1].GetValue(cocoLoader);
}
if(strcmp(className, "CCNode") == 0)
{
@ -366,17 +366,17 @@ cocos2d::Node* SceneReader::createObject(CocoLoader *cocoLoader, stExpCocoNode *
{
count = pNodeArray[13].GetChildNum();
}
stExpCocoNode *pComponents = pNodeArray[13].GetChildArray();
stExpCocoNode *pComponents = pNodeArray[13].GetChildArray(cocoLoader);
SerData *data = new SerData();
for (int i = 0; i < count; ++i)
{
stExpCocoNode *subDict = pComponents[i].GetChildArray();
stExpCocoNode *subDict = pComponents[i].GetChildArray(cocoLoader);
if (subDict == nullptr)
{
continue;
}
std::string key1 = subDict[1].GetName(cocoLoader);
const char *comName = subDict[1].GetValue();
const char *comName = subDict[1].GetValue(cocoLoader);
Component *pCom = nullptr;
if (key1 == "classname" && comName != nullptr)
{
@ -436,7 +436,7 @@ cocos2d::Node* SceneReader::createObject(CocoLoader *cocoLoader, stExpCocoNode *
gb->addComponent(*iter);
}
stExpCocoNode *pGameObjects = pNodeArray[12].GetChildArray();
stExpCocoNode *pGameObjects = pNodeArray[12].GetChildArray(cocoLoader);
if (pGameObjects != nullptr)
{
int length = pNodeArray[12].GetChildNum();
@ -495,7 +495,7 @@ void SceneReader::setPropertyFromJsonDict(const rapidjson::Value &root, cocos2d:
void SceneReader::setPropertyFromJsonDict(CocoLoader *cocoLoader, stExpCocoNode *cocoNode, cocos2d::Node *node)
{
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
stExpCocoNode *stChildArray = cocoNode->GetChildArray(cocoLoader);
float x = 0.0f, y = 0.0f, fScaleX = 1.0f, fScaleY = 1.0f, fRotationZ = 1.0f;
bool bVisible = false;
int nTag = 0, nZorder = -1;
@ -503,7 +503,7 @@ void SceneReader::setPropertyFromJsonDict(CocoLoader *cocoLoader, stExpCocoNode
for (int i = 0; i < cocoNode->GetChildNum(); ++i)
{
std::string key = stChildArray[i].GetName(cocoLoader);
std::string value = stChildArray[i].GetValue();
std::string value = stChildArray[i].GetValue(cocoLoader);
if (key == "x")
{

View File

@ -1,5 +1,5 @@
#include "CocoLoader.h"
#include "zlib.h"
using namespace std;
using namespace rapidjson;
@ -7,190 +7,225 @@ using namespace rapidjson;
namespace cocostudio{
char cTypeName[] = {'N','F','T','O','A','S','V'};
const char* kTypeNames[] = { "Null", "False", "True", "Object", "Array", "String", "Number" };
const char* kObjKeyName[] = { "__type" , "classname" };
char g_Buff[2048];
Type stExpCocoNode::GetType(CocoLoader* pCoco)
char* stExpCocoAttribDesc::GetName(CocoLoader* pCoco)
{
Type tType = kObjectType;
if(m_ObjIndex >= 0)
{
stExpCocoObjectDesc* tpCocoObjectDesc = pCoco->GetCocoObjectDescArray();
if( m_AttribIndex >= 0 )
{
stExpCocoAttribDesc* tpAttribDescArray = (stExpCocoAttribDesc*) tpCocoObjectDesc[m_ObjIndex].m_pAttribDescArray;
tType = tpAttribDescArray[m_AttribIndex].m_Type;
if(kFalseType == tType || kTrueType == tType)
{
char* szValue = (char*)m_szValue;
if(szValue[0] == '0')
{
return kFalseType;
}
else
{
return kTrueType;
}
}
return ( pCoco->GetMemoryAddr_String() + m_szName );
}
}
else
{
tType = kObjectType;
}
}
else
{
if(m_AttribIndex >= 0)
{
tType = (Type)m_ChildNum;
char* stExpCocoObjectDesc::GetName(CocoLoader* pCoco)
{
return ( pCoco->GetMemoryAddr_String() + m_szName );
}
if(kFalseType == tType || kTrueType == tType)
{
char* szValue = (char*)m_szValue;
if(szValue[0] == '0')
{
return kFalseType;
}
else
{
return kTrueType;
}
}
}
else
{
tType = kArrayType;
}
}
return tType;
int stExpCocoObjectDesc::GetAttribNum()
{
return m_cAttribNum;
}
stExpCocoAttribDesc* stExpCocoObjectDesc::GetAttribDescArray(CocoLoader* pCoco)
{
return (stExpCocoAttribDesc*)( pCoco->GetMemoryAddr_AttribDesc() + m_pAttribDescArray );
}
Type stExpCocoNode::GetType(CocoLoader* pCoco)
{
Type tType = kObjectType;
if(m_ObjIndex >= 0)
{
stExpCocoObjectDesc* tpCocoObjectDesc = pCoco->GetCocoObjectDescArray() ;
if( m_AttribIndex >= 0 )
{
stExpCocoAttribDesc* tpAttribDescArray = (stExpCocoAttribDesc*) tpCocoObjectDesc[m_ObjIndex].GetAttribDescArray(pCoco);
tType = Type(tpAttribDescArray[m_AttribIndex].m_cTypeName - 'N' + kNullType);
if('F' == tType || 'T' == tType)
{
char* szValue = (char*)GetValue(pCoco);
if(szValue[0] == '0')
{
return kFalseType;
}
else
{
return kTrueType;
}
}
}
else
{
tType = kObjectType;
}
}
else
{
if(m_AttribIndex >= 0)
{
tType = (Type)m_ChildNum;
if(kFalseType == tType || kTrueType == tType)
{
char* szValue = (char*)GetValue(pCoco);
if(szValue[0] == '0')
{
return kFalseType;
}
else
{
return kTrueType;
}
}
}
else
{
tType = kArrayType;
}
}
return tType;
}
char* stExpCocoNode::GetName(CocoLoader* pCoco)
{
char* szName = NULL ;
if(m_ObjIndex >= 0)
{
stExpCocoObjectDesc* tpCocoObjectDesc = pCoco->GetCocoObjectDescArray();
if( m_AttribIndex >= 0 )
{
stExpCocoAttribDesc* tpAttribDescArray = (stExpCocoAttribDesc*) tpCocoObjectDesc[m_ObjIndex].m_pAttribDescArray;
szName = (char*)tpAttribDescArray[m_AttribIndex].m_szName;
}
else
{
char* szValue = (char*)m_szValue;
if(szValue[0])
{
szName = (char*)m_szValue;
}
else
{
szName = (char*)tpCocoObjectDesc[m_ObjIndex].m_szName;
}
}
}
else
{
if(m_AttribIndex >= 0)
{
char* pStringAddr = (char*)pCoco->GetCocoObjectDescArray() + pCoco->GetFileHeader()->m_lStringMemAddr ;
szName = m_ChildArray + pStringAddr;
}
else
{
szName = (char*)m_szValue;
}
}
return szName ;
char* szName = NULL ;
if(m_ObjIndex >= 0)
{
stExpCocoObjectDesc* tpCocoObjectDesc = pCoco->GetCocoObjectDescArray();
if( m_AttribIndex >= 0 )
{
stExpCocoAttribDesc* tpAttribDescArray = (stExpCocoAttribDesc*) tpCocoObjectDesc[m_ObjIndex].GetAttribDescArray(pCoco);
szName = tpAttribDescArray[m_AttribIndex].GetName(pCoco);
}
else
{
//»Áπ˚√˚◊÷”ο‡√˚≥∆≤ªÕ¨£¨‘Ú∞¥’Ê µ÷µ…Ë÷√
char* szValue = GetValue(pCoco);
if(szValue[0])
{
// ˝◊È
szName = GetValue(pCoco);
}
else
{
//Ω·ππ
szName = tpCocoObjectDesc[m_ObjIndex].GetName(pCoco);
}
}
}
else
{
if(m_AttribIndex >= 0)
{
char* pStringAddr = (char*)pCoco->GetCocoObjectDescArray() + pCoco->GetFileHeader()->m_lStringMemAddr ;
szName = m_ChildArray + pStringAddr;
}
else
{
szName = (char*)GetValue(pCoco);
}
}
return szName ;
}
char* stExpCocoNode::GetValue()
char* stExpCocoNode::GetValue(CocoLoader* pCoco)
{
return (char*)m_szValue;
return ( pCoco->GetMemoryAddr_String() + m_szValue );
}
int stExpCocoNode::GetChildNum()
{
return m_ChildNum;
return m_ChildNum;
}
stExpCocoNode* stExpCocoNode::GetChildArray()
stExpCocoNode* stExpCocoNode::GetChildArray(CocoLoader* pCoco)
{
return (stExpCocoNode*)m_ChildArray;
}
void stExpCocoNode::ReBuild(char* cocoNodeAddr,char* pStringMemoryAddr)
{
m_szValue = m_szValue + (uint64_t)pStringMemoryAddr;
if( -1 == m_AttribIndex )
{
if(m_ChildNum > 0)
{
m_ChildArray = m_ChildArray + (uint64_t)cocoNodeAddr;
stExpCocoNode* tpChildArray = (stExpCocoNode*)m_ChildArray;
for(int i = 0 ; i < m_ChildNum ; i++)
{
tpChildArray[i].ReBuild(cocoNodeAddr,pStringMemoryAddr);
}
}
}
return (stExpCocoNode*)( pCoco->GetMemoryAddr_CocoNode() + m_ChildArray );
}
CocoLoader::CocoLoader()
{
m_pRootNode = NULL;
m_pObjectDescArray = NULL;
m_pRootNode = NULL;
m_pObjectDescArray = NULL;
m_pMemoryBuff = NULL;
}
CocoLoader::~CocoLoader()
{
if(m_pMemoryBuff)
{
delete[] m_pMemoryBuff;
m_pMemoryBuff = NULL;
}
}
bool CocoLoader::ReadCocoBinBuff(char* pBinBuff)
bool CocoLoader::ReadCocoBinBuff(char* pBinBuff)
{
if(m_pMemoryBuff)return true;
char* pTempBuff = pBinBuff;
m_pFileHeader = (stCocoFileHeader*)pTempBuff;
pTempBuff += sizeof(stCocoFileHeader);
char* pStartAddr = pTempBuff;
m_pObjectDescArray = (stExpCocoObjectDesc*)pStartAddr;
char* pAttrAddr = pStartAddr + m_pFileHeader->m_lAttribMemAddr ;
char* pCocoMemAddr = pStartAddr + m_pFileHeader->m_CocoNodeMemAddr;
char* pStringAddr = pStartAddr + m_pFileHeader->m_lStringMemAddr ;
m_pRootNode = (stExpCocoNode*)pCocoMemAddr;
if(1 == m_pFileHeader->m_nFirstUsed)
{
for(int i = 0 ; i < m_pFileHeader->m_ObjectCount ; i++)
{
m_pObjectDescArray[i].ReBuild(pAttrAddr,pStringAddr) ;
}
m_pRootNode->ReBuild(pCocoMemAddr,pStringAddr);
m_pFileHeader->m_nFirstUsed = 0;
char* pStartAddr = m_pMemoryBuff = pTempBuff;
if( m_pFileHeader->m_nCompressSize > 0 )
{
char* pDestBuff = new char[m_pFileHeader->m_nDataSize];
uLongf dwSrcSize = m_pFileHeader->m_nCompressSize;
uLongf dwDestSize = m_pFileHeader->m_nDataSize;
int nRes = uncompress((Bytef*)pDestBuff,&dwDestSize,(Bytef*)m_pMemoryBuff,dwSrcSize);
pStartAddr = m_pMemoryBuff = pDestBuff;
}
m_pObjectDescArray = (stExpCocoObjectDesc*)pStartAddr;
char* pCocoMemAddr = pStartAddr + m_pFileHeader->m_CocoNodeMemAddr;
m_pRootNode = (stExpCocoNode*)pCocoMemAddr;
return true;
}
stExpCocoObjectDesc* CocoLoader::GetCocoObjectDesc(const char* szObjDesc)
{
for(int i = 0 ; i < m_pFileHeader->m_ObjectCount ; i++)
{
if(0 == strcmp((char*)m_pObjectDescArray[i].m_szName,szObjDesc))
{
return &m_pObjectDescArray[i];
}
}
return NULL;
for(int i = 0 ; i < m_pFileHeader->m_ObjectCount ; i++)
{
if(0 == strcmp((char*)m_pObjectDescArray[i].m_szName,szObjDesc))
{
return &m_pObjectDescArray[i];
}
}
return NULL;
}
stExpCocoObjectDesc* CocoLoader::GetCocoObjectDesc(int vIndex)
{
if(vIndex >= 0 && vIndex < m_pFileHeader->m_ObjectCount)
{
return &m_pObjectDescArray[vIndex];
}
return NULL;
}
char* CocoLoader::GetMemoryAddr_AttribDesc()
{
return m_pMemoryBuff + m_pFileHeader->m_lAttribMemAddr ;
}
char* CocoLoader::GetMemoryAddr_CocoNode()
{
return m_pMemoryBuff + m_pFileHeader->m_CocoNodeMemAddr;
}
char* CocoLoader::GetMemoryAddr_String()
{
return m_pMemoryBuff + m_pFileHeader->m_lStringMemAddr ;
}
}

View File

@ -36,101 +36,80 @@
namespace cocostudio{
class CocoLoader;
struct stExpCocoAttribDesc
{
rapidjson::Type m_Type;
uint64_t m_szName;
uint64_t m_szDefaultValue;
char m_cTypeName;
uint32_t m_szName;
public:
void ReBuild(char* pStringMemoryAddr)
{
m_szName = m_szName + (uint64_t)pStringMemoryAddr;
m_szDefaultValue = m_szDefaultValue + (uint64_t)pStringMemoryAddr;
}
char* GetName(CocoLoader* pCoco);
};
struct stExpCocoObjectDesc
{
uint32_t m_nAttribNum;
uint64_t m_szName;
uint64_t m_pAttribDescArray;
unsigned char m_cAttribNum;
uint32_t m_szName;
uint32_t m_pAttribDescArray;
public:
stExpCocoObjectDesc()
{
m_nAttribNum = 0;
m_szName = 0;
m_pAttribDescArray = 0;
}
void ReBuild(char* pAttribMemoryAddr,char* pStringMemoryAddr)
{
m_szName = m_szName + (uint64_t)pStringMemoryAddr;
m_pAttribDescArray = m_pAttribDescArray + (uint64_t)pAttribMemoryAddr;
stExpCocoAttribDesc* tpAttribDescArray = (stExpCocoAttribDesc*)m_pAttribDescArray;
for(uint32_t i = 0 ; i < m_nAttribNum ; i++)
{
tpAttribDescArray[i].ReBuild(pStringMemoryAddr);
}
}
char* GetName(CocoLoader* pCoco);
int GetAttribNum();
stExpCocoAttribDesc* GetAttribDescArray(CocoLoader* pCoco);
};
class CocoLoader;
struct stExpCocoNode
struct stExpCocoNode
{
protected:
int32_t m_ObjIndex;
int32_t m_AttribIndex;
uint32_t m_ChildNum;
uint64_t m_szValue;
uint64_t m_ChildArray;
public:
rapidjson::Type GetType(CocoLoader* pCoco);
char* GetName(CocoLoader* pCoco);
char* GetValue();
int GetChildNum();
stExpCocoNode* GetChildArray();
int16_t m_ObjIndex;
int16_t m_AttribIndex;
unsigned char m_ChildNum;
uint32_t m_szValue;
uint32_t m_ChildArray;
public:
inline void ReBuild(char* cocoNodeAddr,char* pStringMemoryAddr);
void WriteJson(CocoLoader* pCoco, void* pFileName = NULL, int vLayer = 0, bool bEndNode = false, bool bParentNodeIsArray = false);
rapidjson::Type GetType(CocoLoader* pCoco);
char* GetName(CocoLoader* pCoco);
char* GetValue(CocoLoader* pCoco);
int GetChildNum();
stExpCocoNode* GetChildArray(CocoLoader* pCoco);
public:
void WriteJson(CocoLoader* pCoco,void* pFileName = nullptr, int vLayer = 0, bool bEndNode = false, bool bParentNodeIsArray = false);
};
struct stCocoFileHeader
{
char m_FileDesc[32];
char m_Version[32];
uint32_t m_nFirstUsed;
uint32_t m_ObjectCount;
uint64_t m_lAttribMemAddr;
uint64_t m_CocoNodeMemAddr;
uint64_t m_lStringMemAddr;
char m_FileDesc[32];
char m_Version[32];
uint32_t m_nDataSize;
uint32_t m_nCompressSize;
uint32_t m_ObjectCount;
uint32_t m_lAttribMemAddr;
uint32_t m_CocoNodeMemAddr;
uint32_t m_lStringMemAddr;
};
class CocoLoader
{
private:
stCocoFileHeader* m_pFileHeader;
stExpCocoNode* m_pRootNode;
stExpCocoObjectDesc* m_pObjectDescArray;
stCocoFileHeader* m_pFileHeader;
stExpCocoNode* m_pRootNode;
stExpCocoObjectDesc* m_pObjectDescArray;
char* m_pMemoryBuff;
public:
CocoLoader();
~CocoLoader();
CocoLoader();
~CocoLoader();
public:
bool ReadCocoBinBuff(char* pBinBuff);
stCocoFileHeader* GetFileHeader(){return m_pFileHeader;}
stExpCocoNode* GetRootCocoNode(){return m_pRootNode;}
stExpCocoObjectDesc* GetCocoObjectDescArray(){return m_pObjectDescArray;}
stExpCocoObjectDesc* GetCocoObjectDesc(const char* szObjDesc);
bool ReadCocoBinBuff(char* pBinBuff);
stCocoFileHeader* GetFileHeader(){return m_pFileHeader;}
stExpCocoNode* GetRootCocoNode(){return m_pRootNode;}
stExpCocoObjectDesc* GetCocoObjectDescArray(){return m_pObjectDescArray;}
stExpCocoObjectDesc* GetCocoObjectDesc(const char* szObjDesc);
stExpCocoObjectDesc* GetCocoObjectDesc(int vIndex);
char* GetMemoryAddr_AttribDesc();
char* GetMemoryAddr_CocoNode();
char* GetMemoryAddr_String();
};
}

View File

@ -111,7 +111,7 @@ void TriggerMng::parse(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCoc
CCLOG("%s", triggerMngVersion());
int count = pCocoNode[13].GetChildNum();
stExpCocoNode *pTriggersArray = pCocoNode[13].GetChildArray();
stExpCocoNode *pTriggersArray = pCocoNode[13].GetChildArray(pCocoLoader);
#if CC_ENABLE_SCRIPT_BINDING
ScriptEngineProtocol* engine = ScriptEngineManager::getInstance()->getScriptEngine();
@ -200,7 +200,7 @@ bool TriggerMng::isEmpty(void) const
int extent = 0;
int border = 0;
std::string key0;
stExpCocoNode *pTriggersArray = pCocoNode[13].GetChildArray();
stExpCocoNode *pTriggersArray = pCocoNode[13].GetChildArray(pCocoLoader);
document.SetArray();
@ -210,28 +210,28 @@ bool TriggerMng::isEmpty(void) const
rapidjson::Value vElemItem(rapidjson::kObjectType);
border = pTriggersArray[i0].GetChildNum();
stExpCocoNode *pTriggerArray = pTriggersArray[i0].GetChildArray();
stExpCocoNode *pTriggerArray = pTriggersArray[i0].GetChildArray(pCocoLoader);
for (int i1 = 0; i1 < border; ++i1)
{
std::string key1 = pTriggerArray[i1].GetName(pCocoLoader);
const char *str1 = pTriggerArray[i1].GetValue();
const char *str1 = pTriggerArray[i1].GetValue(pCocoLoader);
if (key1.compare("actions") == 0)
{
rapidjson::Value actionsItem(rapidjson::kArrayType);
length = pTriggerArray[i1].GetChildNum();
stExpCocoNode *pActionsArray = pTriggerArray[i1].GetChildArray();
stExpCocoNode *pActionsArray = pTriggerArray[i1].GetChildArray(pCocoLoader);
for (int i2 = 0; i2 < length; ++i2)
{
rapidjson::Value action(rapidjson::kObjectType);
num = pActionsArray[i2].GetChildNum();
stExpCocoNode *pActionArray = pActionsArray[i2].GetChildArray();
stExpCocoNode *pActionArray = pActionsArray[i2].GetChildArray(pCocoLoader);
for (int i3 = 0; i3 < num; ++i3)
{
std::string key2 = pActionArray[i3].GetName(pCocoLoader);
const char *str2 = pActionArray[i3].GetValue();
const char *str2 = pActionArray[i3].GetValue(pCocoLoader);
if (key2.compare("classname") == 0)
{
if (str2 != NULL)
@ -243,16 +243,16 @@ bool TriggerMng::isEmpty(void) const
{
rapidjson::Value dataitems(rapidjson::kArrayType);
size = pActionArray[i3].GetChildNum();
stExpCocoNode *pDataItemsArray = pActionArray[i3].GetChildArray();
stExpCocoNode *pDataItemsArray = pActionArray[i3].GetChildArray(pCocoLoader);
for (int i4 = 0; i4 < size; ++i4)
{
rapidjson::Value dataitem(rapidjson::kObjectType);
extent = pDataItemsArray[i4].GetChildNum();
stExpCocoNode *pDataItemArray = pDataItemsArray[i4].GetChildArray();
stExpCocoNode *pDataItemArray = pDataItemsArray[i4].GetChildArray(pCocoLoader);
for (int i5 = 0; i5 < extent; ++i5)
{
std::string key3 = pDataItemArray[i5].GetName(pCocoLoader);
const char *str3 = pDataItemArray[i5].GetValue();
const char *str3 = pDataItemArray[i5].GetValue(pCocoLoader);
if (key3.compare("key") == 0)
{
if (str3 != NULL)
@ -297,17 +297,17 @@ bool TriggerMng::isEmpty(void) const
rapidjson::Value condsItem(rapidjson::kArrayType);
length = pTriggerArray[i1].GetChildNum();
stExpCocoNode *pConditionsArray = pTriggerArray[i1].GetChildArray();
stExpCocoNode *pConditionsArray = pTriggerArray[i1].GetChildArray(pCocoLoader);
for (int i6 = 0; i6 < length; ++i6)
{
rapidjson::Value cond(rapidjson::kObjectType);
num = pConditionsArray[i6].GetChildNum();
stExpCocoNode *pConditionArray = pConditionsArray[i6].GetChildArray();
stExpCocoNode *pConditionArray = pConditionsArray[i6].GetChildArray(pCocoLoader);
for (int i7 = 0; i7 < num; ++i7)
{
std::string key4 = pConditionArray[i7].GetName(pCocoLoader);
const char *str4 = pConditionArray[i7].GetValue();
const char *str4 = pConditionArray[i7].GetValue(pCocoLoader);
if (key4.compare("classname") == 0)
{
if (str4 != NULL)
@ -319,16 +319,16 @@ bool TriggerMng::isEmpty(void) const
{
rapidjson::Value dataitems(rapidjson::kArrayType);
size = pConditionArray[i7].GetChildNum();
stExpCocoNode *pDataItemsArray = pConditionArray[i7].GetChildArray();
stExpCocoNode *pDataItemsArray = pConditionArray[i7].GetChildArray(pCocoLoader);
for (int i8 = 0; i8 < size; ++i8)
{
rapidjson::Value dataitem(rapidjson::kObjectType);
extent = pDataItemsArray[i8].GetChildNum();
stExpCocoNode *pDataItemArray = pDataItemsArray[i8].GetChildArray();
stExpCocoNode *pDataItemArray = pDataItemsArray[i8].GetChildArray(pCocoLoader);
for (int i9 = 0; i9 < extent; ++i9)
{
std::string key5 = pDataItemArray[i9].GetName(pCocoLoader);
const char *str5 = pDataItemArray[i9].GetValue();
const char *str5 = pDataItemArray[i9].GetValue(pCocoLoader);
if (key5.compare("key") == 0)
{
if (str5 != NULL)
@ -373,13 +373,13 @@ bool TriggerMng::isEmpty(void) const
rapidjson::Value eventsItem(rapidjson::kArrayType);
length = pTriggerArray[i1].GetChildNum();
stExpCocoNode *pEventsArray = pTriggerArray[i1].GetChildArray();
stExpCocoNode *pEventsArray = pTriggerArray[i1].GetChildArray(pCocoLoader);
for (int i10 = 0; i10 < length; ++i10)
{
rapidjson::Value event(rapidjson::kObjectType);
stExpCocoNode *pEventArray = pEventsArray->GetChildArray();
stExpCocoNode *pEventArray = pEventsArray->GetChildArray(pCocoLoader);
std::string key6 = pEventArray[0].GetName(pCocoLoader);
const char *str6 = pEventArray[0].GetValue();
const char *str6 = pEventArray[0].GetValue(pCocoLoader);
if (key6.compare("id") == 0 && str6 != NULL)
{
event.AddMember("id", atoi(str6), allocator);

View File

@ -246,11 +246,11 @@ void TriggerObj::serialize(const rapidjson::Value &val)
int length = pCocoNode->GetChildNum();
int count = 0;
int num = 0;
stExpCocoNode *pTriggerObjArray = pCocoNode->GetChildArray();
stExpCocoNode *pTriggerObjArray = pCocoNode->GetChildArray(pCocoLoader);
for (int i0 = 0; i0 < length; ++i0)
{
std::string key = pTriggerObjArray[i0].GetName(pCocoLoader);
const char* str0 = pTriggerObjArray[i0].GetValue();
const char* str0 = pTriggerObjArray[i0].GetValue(pCocoLoader);
if (key.compare("id") == 0)
{
if (str0 != NULL)
@ -261,12 +261,12 @@ void TriggerObj::serialize(const rapidjson::Value &val)
else if (key.compare("conditions") == 0)
{
count = pTriggerObjArray[i0].GetChildNum();
stExpCocoNode *pConditionsArray = pTriggerObjArray[i0].GetChildArray();
stExpCocoNode *pConditionsArray = pTriggerObjArray[i0].GetChildArray(pCocoLoader);
for (int i1 = 0; i1 < count; ++i1)
{
num = pConditionsArray[i1].GetChildNum();
stExpCocoNode *pConditionArray = pConditionsArray[i1].GetChildArray();
const char *classname = pConditionArray[0].GetValue();
stExpCocoNode *pConditionArray = pConditionsArray[i1].GetChildArray(pCocoLoader);
const char *classname = pConditionArray[0].GetValue(pCocoLoader);
if (classname == nullptr)
{
continue;
@ -281,12 +281,12 @@ void TriggerObj::serialize(const rapidjson::Value &val)
else if (key.compare("actions") == 0)
{
count = pTriggerObjArray[i0].GetChildNum();
stExpCocoNode *pActionsArray = pTriggerObjArray[i0].GetChildArray();
stExpCocoNode *pActionsArray = pTriggerObjArray[i0].GetChildArray(pCocoLoader);
for (int i2 = 0; i2 < count; ++i2)
{
num = pActionsArray[i2].GetChildNum();
stExpCocoNode *pActionArray = pActionsArray[i2].GetChildArray();
const char *classname = pActionArray[0].GetValue();
stExpCocoNode *pActionArray = pActionsArray[i2].GetChildArray(pCocoLoader);
const char *classname = pActionArray[0].GetValue(pCocoLoader);
if (classname == nullptr)
{
continue;
@ -301,12 +301,12 @@ void TriggerObj::serialize(const rapidjson::Value &val)
else if (key.compare("events") == 0)
{
count = pTriggerObjArray[i0].GetChildNum();
stExpCocoNode *pEventsArray = pTriggerObjArray[i0].GetChildArray();
stExpCocoNode *pEventsArray = pTriggerObjArray[i0].GetChildArray(pCocoLoader);
for (int i3 = 0; i3 < count; ++i3)
{
num = pEventsArray[i3].GetChildNum();
stExpCocoNode *pEventArray = pEventsArray[i3].GetChildArray();
const char *str1 = pEventArray[0].GetValue();
stExpCocoNode *pEventArray = pEventsArray[i3].GetChildArray(pCocoLoader);
const char *str1 = pEventArray[0].GetValue(pCocoLoader);
if (str1 == nullptr)
{
continue;

View File

@ -63,7 +63,7 @@ namespace cocostudio
Button *button = static_cast<Button*>(widget);
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
stExpCocoNode *stChildArray = cocoNode->GetChildArray(cocoLoader);
this->beginSetBasicProperties(widget);
@ -72,7 +72,7 @@ namespace cocostudio
float scale9Width = 0.0f, scale9Height = 0.0f;
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(cocoLoader);
std::string value = stChildArray[i].GetValue();
std::string value = stChildArray[i].GetValue(cocoLoader);
// CCLOG("Button: key = %s, value = %d", key.c_str(), i);
//read all basic properties of widget
@ -86,8 +86,8 @@ namespace cocostudio
}
else if (key == P_NormalData){
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
std::string resType = backGroundChildren[2].GetValue();;
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray(cocoLoader);
std::string resType = backGroundChildren[2].GetValue(cocoLoader);;
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
@ -98,8 +98,8 @@ namespace cocostudio
}
else if (key == P_PressedData){
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
std::string resType = backGroundChildren[2].GetValue();;
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray(cocoLoader);
std::string resType = backGroundChildren[2].GetValue(cocoLoader);;
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
@ -110,8 +110,8 @@ namespace cocostudio
}
else if (key == P_DisabledData){
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
std::string resType = backGroundChildren[2].GetValue();;
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray(cocoLoader);
std::string resType = backGroundChildren[2].GetValue(cocoLoader);;
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);

View File

@ -43,11 +43,11 @@ namespace cocostudio
CheckBox *checkBox = static_cast<CheckBox*>(widget);
this->beginSetBasicProperties(widget);
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
stExpCocoNode *stChildArray = cocoNode->GetChildArray(cocoLoader);
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(cocoLoader);
std::string value = stChildArray[i].GetValue();
std::string value = stChildArray[i].GetValue(cocoLoader);
// CCLOG("key = %s, index : %d", key.c_str(), i);
//read all basic properties of widget
CC_BASIC_PROPERTY_BINARY_READER
@ -56,8 +56,8 @@ namespace cocostudio
else if (key == P_BackGroundBoxData){
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
std::string resType = backGroundChildren[2].GetValue();;
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray(cocoLoader);
std::string resType = backGroundChildren[2].GetValue(cocoLoader);;
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
@ -65,8 +65,8 @@ namespace cocostudio
checkBox->loadTextureBackGround(backgroundValue, imageFileNameType);
}else if(key == P_BackGroundBoxSelectedData){
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
std::string resType = backGroundChildren[2].GetValue();;
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray(cocoLoader);
std::string resType = backGroundChildren[2].GetValue(cocoLoader);;
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
@ -74,8 +74,8 @@ namespace cocostudio
checkBox->loadTextureBackGroundSelected(backgroundValue, imageFileNameType);
}else if(key == P_FrontCrossData){
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
std::string resType = backGroundChildren[2].GetValue();;
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray(cocoLoader);
std::string resType = backGroundChildren[2].GetValue(cocoLoader);;
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
@ -83,8 +83,8 @@ namespace cocostudio
checkBox->loadTextureFrontCross(backgroundValue, imageFileNameType);
}else if(key == P_BackGroundBoxDisabledData){
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
std::string resType = backGroundChildren[2].GetValue();;
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray(cocoLoader);
std::string resType = backGroundChildren[2].GetValue(cocoLoader);;
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
@ -92,8 +92,8 @@ namespace cocostudio
checkBox->loadTextureBackGroundDisabled(backgroundValue, imageFileNameType);
}else if (key == P_FrontCrossDisabledData){
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
std::string resType = backGroundChildren[2].GetValue();;
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray(cocoLoader);
std::string resType = backGroundChildren[2].GetValue(cocoLoader);;
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);

View File

@ -50,11 +50,11 @@ namespace cocostudio
this->beginSetBasicProperties(widget);
float capsx = 0.0f, capsy = 0.0, capsWidth = 0.0, capsHeight = 0.0f;
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
stExpCocoNode *stChildArray = cocoNode->GetChildArray(cocoLoader);
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(cocoLoader);
std::string value = stChildArray[i].GetValue();
std::string value = stChildArray[i].GetValue(cocoLoader);
//read all basic properties of widget
CC_BASIC_PROPERTY_BINARY_READER
@ -65,8 +65,8 @@ namespace cocostudio
imageView->setScale9Enabled(valueToBool(value));
}
else if (key == P_FileNameData){
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
std::string resType = backGroundChildren[2].GetValue();;
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray(cocoLoader);
std::string resType = backGroundChildren[2].GetValue(cocoLoader);;
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);

View File

@ -61,7 +61,7 @@ namespace cocostudio
Layout* panel = static_cast<Layout*>(widget);
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
stExpCocoNode *stChildArray = cocoNode->GetChildArray(cocoLoader);
this->beginSetBasicProperties(widget);
int cr=0, cg = 0, cb = 0;
@ -74,7 +74,7 @@ namespace cocostudio
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(cocoLoader);
std::string value = stChildArray[i].GetValue();
std::string value = stChildArray[i].GetValue(cocoLoader);
//read all basic properties of widget
CC_BASIC_PROPERTY_BINARY_READER
@ -120,9 +120,9 @@ namespace cocostudio
panel->setBackGroundColorType(Layout::BackGroundColorType(valueToInt(value)));
}else if (key == P_BackGroundImageData){
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray(cocoLoader);
if (backGroundChildren) {
std::string resType = backGroundChildren[2].GetValue();;
std::string resType = backGroundChildren[2].GetValue(cocoLoader);;
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);

View File

@ -41,11 +41,11 @@ namespace cocostudio
ListView* listView = static_cast<ListView*>(widget);
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
stExpCocoNode *stChildArray = cocoNode->GetChildArray(cocoLoader);
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(cocoLoader);
std::string value = stChildArray[i].GetValue();
std::string value = stChildArray[i].GetValue(cocoLoader);
if (key == P_Direction) {
listView->setDirection((ScrollView::Direction)valueToInt(value));

View File

@ -51,11 +51,11 @@ namespace cocostudio
float capsx = 0.0f, capsy = 0.0, capsWidth = 0.0, capsHeight = 0.0f;
int percent = loadingBar->getPercent();
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
stExpCocoNode *stChildArray = cocoNode->GetChildArray(cocoLoader);
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(cocoLoader);
std::string value = stChildArray[i].GetValue();
std::string value = stChildArray[i].GetValue(cocoLoader);
//read all basic properties of widget
CC_BASIC_PROPERTY_BINARY_READER
@ -67,8 +67,8 @@ namespace cocostudio
}
else if (key == P_TextureData){
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
std::string resType = backGroundChildren[2].GetValue();;
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray(cocoLoader);
std::string resType = backGroundChildren[2].GetValue(cocoLoader);;
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);

View File

@ -44,12 +44,12 @@ namespace cocostudio
ScrollView* scrollView = static_cast<ScrollView*>(widget);
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
stExpCocoNode *stChildArray = cocoNode->GetChildArray(cocoLoader);
float innerWidth;
float innerHeight;
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(cocoLoader);
std::string value = stChildArray[i].GetValue();
std::string value = stChildArray[i].GetValue(cocoLoader);
if (key == P_InnerWidth) {
innerWidth = valueToFloat(value);
}

View File

@ -51,11 +51,11 @@ namespace cocostudio
float barLength = 0.0f;
int percent = slider->getPercent();
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
stExpCocoNode *stChildArray = cocoNode->GetChildArray(cocoLoader);
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(cocoLoader);
std::string value = stChildArray[i].GetValue();
std::string value = stChildArray[i].GetValue(cocoLoader);
//read all basic properties of widget
CC_BASIC_PROPERTY_BINARY_READER
@ -69,8 +69,8 @@ namespace cocostudio
else if(key == P_Percent){
percent = valueToInt(value);
}else if(key == P_BarFileNameData){
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
std::string resType = backGroundChildren[2].GetValue();;
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray(cocoLoader);
std::string resType = backGroundChildren[2].GetValue(cocoLoader);;
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
@ -81,8 +81,8 @@ namespace cocostudio
}else if(key == P_Length){
barLength = valueToFloat(value);
}else if(key == P_BallNormalData){
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
std::string resType = backGroundChildren[2].GetValue();;
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray(cocoLoader);
std::string resType = backGroundChildren[2].GetValue(cocoLoader);;
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
@ -91,8 +91,8 @@ namespace cocostudio
slider->loadSlidBallTextureNormal(backgroundValue, imageFileNameType);
}else if(key == P_BallPressedData){
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
std::string resType = backGroundChildren[2].GetValue();;
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray(cocoLoader);
std::string resType = backGroundChildren[2].GetValue(cocoLoader);;
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
@ -101,8 +101,8 @@ namespace cocostudio
slider->loadSlidBallTexturePressed(backgroundValue, imageFileNameType);
}else if(key == P_BallDisabledData){
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
std::string resType = backGroundChildren[2].GetValue();;
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray(cocoLoader);
std::string resType = backGroundChildren[2].GetValue(cocoLoader);;
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
@ -111,8 +111,8 @@ namespace cocostudio
slider->loadSlidBallTextureDisabled(backgroundValue, imageFileNameType);
}else if(key == P_ProgressBarData){
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
std::string resType = backGroundChildren[2].GetValue();;
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray(cocoLoader);
std::string resType = backGroundChildren[2].GetValue(cocoLoader);;
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);

View File

@ -48,7 +48,7 @@ namespace cocostudio
TextAtlas* labelAtlas = static_cast<TextAtlas*>(widget);
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
stExpCocoNode *stChildArray = cocoNode->GetChildArray(cocoLoader);
Widget::TextureResType type;
std::string charMapFileName;
std::string stringValue;
@ -57,7 +57,7 @@ namespace cocostudio
float itemHeight;
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(cocoLoader);
std::string value = stChildArray[i].GetValue();
std::string value = stChildArray[i].GetValue(cocoLoader);
//read all basic properties of widget
CC_BASIC_PROPERTY_BINARY_READER
@ -68,8 +68,8 @@ namespace cocostudio
stringValue = value;
}
else if(key == P_CharMapFileData){
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
std::string resType = backGroundChildren[2].GetValue();;
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray(cocoLoader);
std::string resType = backGroundChildren[2].GetValue(cocoLoader);;
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);

View File

@ -42,19 +42,19 @@ namespace cocostudio
TextBMFont* labelBMFont = static_cast<TextBMFont*>(widget);
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
stExpCocoNode *stChildArray = cocoNode->GetChildArray(cocoLoader);
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(cocoLoader);
std::string value = stChildArray[i].GetValue();
std::string value = stChildArray[i].GetValue(cocoLoader);
//read all basic properties of widget
CC_BASIC_PROPERTY_BINARY_READER
//read all color related properties of widget
CC_COLOR_PROPERTY_BINARY_READER
else if(key == P_FileNameData){
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
std::string resType = backGroundChildren[2].GetValue();;
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray(cocoLoader);
std::string resType = backGroundChildren[2].GetValue(cocoLoader);;
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);

View File

@ -49,11 +49,11 @@ namespace cocostudio
TextField* textField = static_cast<TextField*>(widget);
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
stExpCocoNode *stChildArray = cocoNode->GetChildArray(cocoLoader);
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(cocoLoader);
std::string value = stChildArray[i].GetValue();
std::string value = stChildArray[i].GetValue(cocoLoader);
//read all basic properties of widget
CC_BASIC_PROPERTY_BINARY_READER

View File

@ -45,7 +45,7 @@ namespace cocostudio
{
this->beginSetBasicProperties(widget);
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
stExpCocoNode *stChildArray = cocoNode->GetChildArray(cocoLoader);
Text* label = static_cast<Text*>(widget);
@ -54,7 +54,7 @@ namespace cocostudio
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(cocoLoader);
std::string value = stChildArray[i].GetValue();
std::string value = stChildArray[i].GetValue(cocoLoader);
//read all basic properties of widget
CC_BASIC_PROPERTY_BINARY_READER
//read all color related properties of widget

View File

@ -295,8 +295,8 @@ namespace cocostudio
std::string WidgetReader::getResourcePath(CocoLoader *cocoLoader, stExpCocoNode *cocoNode, cocos2d::ui::Widget::TextureResType texType)
{
stExpCocoNode *backGroundChildren = cocoNode->GetChildArray();
std::string backgroundValue = backGroundChildren[0].GetValue();
stExpCocoNode *backGroundChildren = cocoNode->GetChildArray(cocoLoader);
std::string backgroundValue = backGroundChildren[0].GetValue(cocoLoader);
if (backgroundValue.size() < 3) {
return "";
@ -346,13 +346,13 @@ namespace cocostudio
void WidgetReader::setPropsFromBinary(cocos2d::ui::Widget *widget, cocostudio::CocoLoader *cocoLoader, cocostudio::stExpCocoNode *cocoNode)
{
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
stExpCocoNode *stChildArray = cocoNode->GetChildArray(cocoLoader);
this->beginSetBasicProperties(widget);
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(cocoLoader);
std::string value = stChildArray[i].GetValue();
std::string value = stChildArray[i].GetValue(cocoLoader);
CC_BASIC_PROPERTY_BINARY_READER
}

View File

@ -176,14 +176,14 @@ namespace cocostudio
}else if(key == P_ZOrder){ \
widget->setZOrder(valueToInt(value)); \
}else if(key == P_LayoutParameter){ \
stExpCocoNode *layoutCocosNode = stChildArray[i].GetChildArray(); \
stExpCocoNode *layoutCocosNode = stChildArray[i].GetChildArray(cocoLoader); \
ui::LinearLayoutParameter *linearParameter = ui::LinearLayoutParameter::create(); \
ui::RelativeLayoutParameter *relativeParameter = ui::RelativeLayoutParameter::create(); \
ui::Margin mg; \
int paramType = -1; \
for (int j = 0; j < stChildArray[i].GetChildNum(); ++j) { \
std::string innerKey = layoutCocosNode[j].GetName(cocoLoader); \
std::string innerValue = layoutCocosNode[j].GetValue(); \
std::string innerValue = layoutCocosNode[j].GetValue(cocoLoader); \
if (innerKey == P_Type) { \
paramType = valueToInt(innerValue); \
}else if(innerKey == P_Gravity){ \

View File

@ -188,7 +188,7 @@
<Optimization>Disabled</Optimization>
<SDLCheck>
</SDLCheck>
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support;$(EngineRoot)external;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support;$(EngineRoot)external;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)extensions;$(EngineRoot)external\win32-specific\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<DisableSpecificWarnings>4267;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>

View File

@ -69,15 +69,15 @@ void PlayMusic::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExp
{
int length = pCocoNode->GetChildNum();
int count = 0;
stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray();
stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader);
std::string key;
const char *str = NULL;
for (int i = 0; i < length; ++i)
{
count = pDataItemsArray[i].GetChildNum();
stExpCocoNode *pDataItemArray = pDataItemsArray[i].GetChildArray();
key = pDataItemArray[0].GetValue();
str = pDataItemArray[1].GetValue();
stExpCocoNode *pDataItemArray = pDataItemsArray[i].GetChildArray(pCocoLoader);
key = pDataItemArray[0].GetValue(pCocoLoader);
str = pDataItemArray[1].GetValue(pCocoLoader);
if (key == "Tag")
{
if (str != NULL)
@ -169,15 +169,15 @@ void TMoveTo::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCo
{
int length = pCocoNode->GetChildNum();
int count = 0;
stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray();
stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader);
std::string key;
const char *str = NULL;
for (int i = 0; i < length; ++i)
{
count = pDataItemsArray[i].GetChildNum();
stExpCocoNode *pDataItemArray = pDataItemsArray[i].GetChildArray();
key = pDataItemArray[0].GetValue();
str = pDataItemArray[1].GetValue();
stExpCocoNode *pDataItemArray = pDataItemsArray[i].GetChildArray(pCocoLoader);
key = pDataItemArray[0].GetValue(pCocoLoader);
str = pDataItemArray[1].GetValue(pCocoLoader);
if (key == "Tag")
{
if (str != NULL)
@ -291,15 +291,15 @@ void TMoveBy::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCo
{
int length = pCocoNode->GetChildNum();
int count = 0;
stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray();
stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader);
std::string key;
const char *str = NULL;
for (int i = 0; i < length; ++i)
{
count = pDataItemsArray[i].GetChildNum();
stExpCocoNode *pDataItemArray = pDataItemsArray[i].GetChildArray();
key = pDataItemArray[0].GetValue();
str = pDataItemArray[1].GetValue();
stExpCocoNode *pDataItemArray = pDataItemsArray[i].GetChildArray(pCocoLoader);
key = pDataItemArray[0].GetValue(pCocoLoader);
str = pDataItemArray[1].GetValue(pCocoLoader);
if (key == "Tag")
{
if (str != NULL)
@ -404,15 +404,15 @@ void TRotateTo::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExp
{
int length = pCocoNode->GetChildNum();
int count = 0;
stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray();
stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader);
std::string key;
const char *str = NULL;
for (int i = 0; i < length; ++i)
{
count = pDataItemsArray[i].GetChildNum();
stExpCocoNode *pDataItemArray = pDataItemsArray[i].GetChildArray();
key = pDataItemArray[0].GetValue();
str = pDataItemArray[1].GetValue();
stExpCocoNode *pDataItemArray = pDataItemsArray[i].GetChildArray(pCocoLoader);
key = pDataItemArray[0].GetValue(pCocoLoader);
str = pDataItemArray[1].GetValue(pCocoLoader);
if (key == "Tag")
{
if (str != NULL)
@ -517,15 +517,15 @@ void TRotateBy::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExp
{
int length = pCocoNode->GetChildNum();
int count = 0;
stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray();
stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader);
std::string key;
const char *str = NULL;
for (int i = 0; i < length; ++i)
{
count = pDataItemsArray[i].GetChildNum();
stExpCocoNode *pDataItemArray = pDataItemsArray[i].GetChildArray();
key = pDataItemArray[0].GetValue();
str = pDataItemArray[1].GetValue();
stExpCocoNode *pDataItemArray = pDataItemsArray[i].GetChildArray(pCocoLoader);
key = pDataItemArray[0].GetValue(pCocoLoader);
str = pDataItemArray[1].GetValue(pCocoLoader);
if (key == "Tag")
{
if (str != NULL)
@ -627,15 +627,15 @@ void TScaleTo::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpC
{
int length = pCocoNode->GetChildNum();
int count = 0;
stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray();
stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader);
std::string key;
const char *str = NULL;
for (int i = 0; i < length; ++i)
{
count = pDataItemsArray[i].GetChildNum();
stExpCocoNode *pDataItemArray = pDataItemsArray[i].GetChildArray();
key = pDataItemArray[0].GetValue();
str = pDataItemArray[1].GetValue();
stExpCocoNode *pDataItemArray = pDataItemsArray[i].GetChildArray(pCocoLoader);
key = pDataItemArray[0].GetValue(pCocoLoader);
str = pDataItemArray[1].GetValue(pCocoLoader);
if (key == "Tag")
{
if (str != NULL)
@ -751,15 +751,15 @@ void TScaleBy::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpC
{
int length = pCocoNode->GetChildNum();
int count = 0;
stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray();
stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader);
std::string key;
const char *str = NULL;
for (int i = 0; i < length; ++i)
{
count = pDataItemsArray[i].GetChildNum();
stExpCocoNode *pDataItemArray = pDataItemsArray[i].GetChildArray();
key = pDataItemArray[0].GetValue();
str = pDataItemArray[1].GetValue();
stExpCocoNode *pDataItemArray = pDataItemsArray[i].GetChildArray(pCocoLoader);
key = pDataItemArray[0].GetValue(pCocoLoader);
str = pDataItemArray[1].GetValue(pCocoLoader);
if (key == "Tag")
{
if (str != NULL)
@ -869,15 +869,15 @@ void TSkewTo::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCo
{
int length = pCocoNode->GetChildNum();
int count = 0;
stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray();
stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader);
std::string key;
const char *str = NULL;
for (int i = 0; i < length; ++i)
{
count = pDataItemsArray[i].GetChildNum();
stExpCocoNode *pDataItemArray = pDataItemsArray[i].GetChildArray();
key = pDataItemArray[0].GetValue();
str = pDataItemArray[1].GetValue();
stExpCocoNode *pDataItemArray = pDataItemsArray[i].GetChildArray(pCocoLoader);
key = pDataItemArray[0].GetValue(pCocoLoader);
str = pDataItemArray[1].GetValue(pCocoLoader);
if (key == "Tag")
{
if (str != NULL)
@ -992,15 +992,15 @@ void TSkewBy::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCo
{
int length = pCocoNode->GetChildNum();
int count = 0;
stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray();
stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader);
std::string key;
const char *str = NULL;
for (int i = 0; i < length; ++i)
{
count = pDataItemsArray[i].GetChildNum();
stExpCocoNode *pDataItemArray = pDataItemsArray[i].GetChildArray();
key = pDataItemArray[0].GetValue();
str = pDataItemArray[1].GetValue();
stExpCocoNode *pDataItemArray = pDataItemsArray[i].GetChildArray(pCocoLoader);
key = pDataItemArray[0].GetValue(pCocoLoader);
str = pDataItemArray[1].GetValue(pCocoLoader);
if (key == "Tag")
{
if (str != NULL)
@ -1106,15 +1106,15 @@ void TriggerState::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::st
{
int length = pCocoNode->GetChildNum();
int count = 0;
stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray();
stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader);
std::string key;
const char *str = NULL;
for (int i = 0; i < length; ++i)
{
count = pDataItemsArray[i].GetChildNum();
stExpCocoNode *pDataItemArray = pDataItemsArray[i].GetChildArray();
key = pDataItemArray[0].GetValue();
str = pDataItemArray[1].GetValue();
stExpCocoNode *pDataItemArray = pDataItemsArray[i].GetChildArray(pCocoLoader);
key = pDataItemArray[0].GetValue(pCocoLoader);
str = pDataItemArray[1].GetValue(pCocoLoader);
if (key == "ID")
{
if (str != NULL)
@ -1195,15 +1195,15 @@ void ArmaturePlayAction::serialize(cocostudio::CocoLoader *pCocoLoader, cocostud
{
int length = pCocoNode->GetChildNum();
int count = 0;
stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray();
stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader);
std::string key;
const char *str = NULL;
for (int i = 0; i < length; ++i)
{
count = pDataItemsArray[i].GetChildNum();
stExpCocoNode *pDataItemArray = pDataItemsArray[i].GetChildArray();
key = pDataItemArray[0].GetValue();
str = pDataItemArray[1].GetValue();
stExpCocoNode *pDataItemArray = pDataItemsArray[i].GetChildArray(pCocoLoader);
key = pDataItemArray[0].GetValue(pCocoLoader);
str = pDataItemArray[1].GetValue(pCocoLoader);
if (key == "Tag")
{
if (str != NULL)

View File

@ -51,15 +51,15 @@ void TimeElapsed::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stE
{
int length = pCocoNode->GetChildNum();
int count = 0;
stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray();
stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader);
std::string key;
const char *str = NULL;
for (int i = 0; i < length; ++i)
{
count = pDataItemsArray[i].GetChildNum();
stExpCocoNode *pDataItemArray = pDataItemsArray[i].GetChildArray();
key = pDataItemArray[0].GetValue();
str = pDataItemArray[1].GetValue();
stExpCocoNode *pDataItemArray = pDataItemsArray[i].GetChildArray(pCocoLoader);
key = pDataItemArray[0].GetValue(pCocoLoader);
str = pDataItemArray[1].GetValue(pCocoLoader);
if (key == "TotalTime")
{
if (str != NULL)
@ -151,15 +151,15 @@ void ArmatureActionState::serialize(cocostudio::CocoLoader *pCocoLoader, cocostu
{
int length = pCocoNode->GetChildNum();
int count = 0;
stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray();
stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader);
std::string key;
const char *str = NULL;
for (int i = 0; i < length; ++i)
{
count = pDataItemsArray[i].GetChildNum();
stExpCocoNode *pDataItemArray = pDataItemsArray[i].GetChildArray();
key = pDataItemArray[0].GetValue();
str = pDataItemArray[1].GetValue();
stExpCocoNode *pDataItemArray = pDataItemsArray[i].GetChildArray(pCocoLoader);
key = pDataItemArray[0].GetValue(pCocoLoader);
str = pDataItemArray[1].GetValue(pCocoLoader);
if (key == "Tag")
{
if (str != NULL)
@ -279,15 +279,15 @@ void NodeInRect::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stEx
{
int length = pCocoNode->GetChildNum();
int count = 0;
stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray();
stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader);
std::string key;
const char *str = NULL;
for (int i = 0; i < length; ++i)
{
count = pDataItemsArray[i].GetChildNum();
stExpCocoNode *pDataItemArray = pDataItemsArray[i].GetChildArray();
key = pDataItemArray[0].GetValue();
str = pDataItemArray[1].GetValue();
stExpCocoNode *pDataItemArray = pDataItemsArray[i].GetChildArray(pCocoLoader);
key = pDataItemArray[0].GetValue(pCocoLoader);
str = pDataItemArray[1].GetValue(pCocoLoader);
if (key == "Tag")
{
if (str != NULL)
@ -381,15 +381,15 @@ void NodeVisible::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stE
{
int length = pCocoNode->GetChildNum();
int count = 0;
stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray();
stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader);
std::string key;
const char *str = NULL;
for (int i = 0; i < length; ++i)
{
count = pDataItemsArray[i].GetChildNum();
stExpCocoNode *pDataItemArray = pDataItemsArray[i].GetChildArray();
key = pDataItemArray[0].GetValue();
str = pDataItemArray[1].GetValue();
stExpCocoNode *pDataItemArray = pDataItemsArray[i].GetChildArray(pCocoLoader);
key = pDataItemArray[0].GetValue(pCocoLoader);
str = pDataItemArray[1].GetValue(pCocoLoader);
if (key == "Tag")
{
if (str != NULL)