mirror of https://github.com/axmolengine/axmol.git
remove Hungry style
This commit is contained in:
parent
5624da5448
commit
8a463e7964
|
@ -74,7 +74,7 @@ void ActionManagerEx::initWithDictionary(const char* jsonName,const rapidjson::V
|
||||||
|
|
||||||
void ActionManagerEx::initWithBinary(const char* file,
|
void ActionManagerEx::initWithBinary(const char* file,
|
||||||
cocos2d::Ref *root,
|
cocos2d::Ref *root,
|
||||||
CocoLoader* pCocoLoader,
|
CocoLoader* cocoLoader,
|
||||||
stExpCocoNode* pCocoNode)
|
stExpCocoNode* pCocoNode)
|
||||||
{
|
{
|
||||||
std::string path = file;
|
std::string path = file;
|
||||||
|
@ -86,7 +86,7 @@ void ActionManagerEx::initWithDictionary(const char* jsonName,const rapidjson::V
|
||||||
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
|
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
|
||||||
stExpCocoNode *actionNode = NULL;
|
stExpCocoNode *actionNode = NULL;
|
||||||
for (int i=0; i < pCocoNode->GetChildNum(); ++i) {
|
for (int i=0; i < pCocoNode->GetChildNum(); ++i) {
|
||||||
std::string key = stChildArray[i].GetName(pCocoLoader);
|
std::string key = stChildArray[i].GetName(cocoLoader);
|
||||||
if (key == "actionlist") {
|
if (key == "actionlist") {
|
||||||
actionNode = &stChildArray[i];
|
actionNode = &stChildArray[i];
|
||||||
break;
|
break;
|
||||||
|
@ -99,7 +99,7 @@ void ActionManagerEx::initWithDictionary(const char* jsonName,const rapidjson::V
|
||||||
ActionObject* action = new ActionObject();
|
ActionObject* action = new ActionObject();
|
||||||
action->autorelease();
|
action->autorelease();
|
||||||
|
|
||||||
action->initWithBinary(pCocoLoader, actionNode->GetChildArray(), root);
|
action->initWithBinary(cocoLoader, actionNode->GetChildArray(), root);
|
||||||
|
|
||||||
actionList.pushBack(action);
|
actionList.pushBack(action);
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ public:
|
||||||
|
|
||||||
/*init properties with json dictionay*/
|
/*init properties with json dictionay*/
|
||||||
void initWithDictionary(const char* jsonName,const rapidjson::Value &dic, Ref* root);
|
void initWithDictionary(const char* jsonName,const rapidjson::Value &dic, Ref* root);
|
||||||
void initWithBinary(const char* file, Ref* root, CocoLoader* pCocoLoader, stExpCocoNode* pCocoNode);
|
void initWithBinary(const char* file, Ref* root, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Release all actions.
|
* Release all actions.
|
||||||
|
|
|
@ -187,18 +187,18 @@ void ActionNode::initWithDictionary(const rapidjson::Value& dic, Ref* root)
|
||||||
return atof(value.c_str());
|
return atof(value.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionNode::initWithBinary(CocoLoader *pCocoLoader,
|
void ActionNode::initWithBinary(CocoLoader *cocoLoader,
|
||||||
stExpCocoNode *pCocoNode,
|
stExpCocoNode *cocoNode,
|
||||||
cocos2d::Ref *root)
|
cocos2d::Ref *root)
|
||||||
{
|
{
|
||||||
|
|
||||||
stExpCocoNode *stChildNode = pCocoNode;
|
stExpCocoNode *stChildNode = cocoNode;
|
||||||
|
|
||||||
int actionNodeCount = stChildNode->GetChildNum();
|
int actionNodeCount = stChildNode->GetChildNum();
|
||||||
stChildNode = stChildNode[0].GetChildArray();
|
stChildNode = stChildNode[0].GetChildArray();
|
||||||
stExpCocoNode *frameListNode = NULL;
|
stExpCocoNode *frameListNode = NULL;
|
||||||
for (int i = 0; i < actionNodeCount; ++i) {
|
for (int i = 0; i < actionNodeCount; ++i) {
|
||||||
std::string key = stChildNode[i].GetName(pCocoLoader);
|
std::string key = stChildNode[i].GetName(cocoLoader);
|
||||||
std::string value = stChildNode[i].GetValue();
|
std::string value = stChildNode[i].GetValue();
|
||||||
if (key == "ActionTag") {
|
if (key == "ActionTag") {
|
||||||
setActionTag(valueToInt(value));
|
setActionTag(valueToInt(value));
|
||||||
|
@ -227,7 +227,7 @@ void ActionNode::initWithDictionary(const rapidjson::Value& dic, Ref* root)
|
||||||
int framesCount = stFrameChildNode[i].GetChildNum();
|
int framesCount = stFrameChildNode[i].GetChildNum();
|
||||||
stExpCocoNode *innerFrameNode = stFrameChildNode[i].GetChildArray();
|
stExpCocoNode *innerFrameNode = stFrameChildNode[i].GetChildArray();
|
||||||
for (int j = 0; j < framesCount; j++) {
|
for (int j = 0; j < framesCount; j++) {
|
||||||
std::string key = innerFrameNode[j].GetName(pCocoLoader);
|
std::string key = innerFrameNode[j].GetName(cocoLoader);
|
||||||
std::string value = innerFrameNode[j].GetValue();
|
std::string value = innerFrameNode[j].GetValue();
|
||||||
|
|
||||||
if (key == "frameid") {
|
if (key == "frameid") {
|
||||||
|
@ -239,7 +239,7 @@ void ActionNode::initWithDictionary(const rapidjson::Value& dic, Ref* root)
|
||||||
int tweenParameterCount = innerFrameNode[j].GetChildNum();
|
int tweenParameterCount = innerFrameNode[j].GetChildNum();
|
||||||
stExpCocoNode *tweenParameterArray = innerFrameNode[j].GetChildArray();
|
stExpCocoNode *tweenParameterArray = innerFrameNode[j].GetChildArray();
|
||||||
for (int k = 0; k < tweenParameterCount; ++k) {
|
for (int k = 0; k < tweenParameterCount; ++k) {
|
||||||
std::string t_key = tweenParameterArray[j].GetName(pCocoLoader);
|
std::string t_key = tweenParameterArray[j].GetName(cocoLoader);
|
||||||
std::string t_value = tweenParameterArray[j].GetValue();
|
std::string t_value = tweenParameterArray[j].GetValue();
|
||||||
frameTweenParameter.push_back(valueToFloat(t_value));
|
frameTweenParameter.push_back(valueToFloat(t_value));
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,7 @@ public:
|
||||||
|
|
||||||
/*init properties with a json dictionary*/
|
/*init properties with a json dictionary*/
|
||||||
virtual void initWithDictionary(const rapidjson::Value& dic, cocos2d::Ref* root);
|
virtual void initWithDictionary(const rapidjson::Value& dic, cocos2d::Ref* root);
|
||||||
virtual void initWithBinary(CocoLoader* pCocoLoader, stExpCocoNode* pCocoNode, Ref* root);
|
virtual void initWithBinary(CocoLoader* cocoLoader, stExpCocoNode* pCocoNode, Ref* root);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets if the action is done once time.
|
* Gets if the action is done once time.
|
||||||
|
|
|
@ -128,15 +128,15 @@ void ActionObject::initWithDictionary(const rapidjson::Value& dic, Ref* root)
|
||||||
_fTotalTime = maxLength*_fUnitTime;
|
_fTotalTime = maxLength*_fUnitTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionObject::initWithBinary(CocoLoader *pCocoLoader,
|
void ActionObject::initWithBinary(CocoLoader *cocoLoader,
|
||||||
stExpCocoNode *pCocoNode,
|
stExpCocoNode *cocoNode,
|
||||||
cocos2d::Ref *root)
|
cocos2d::Ref *root)
|
||||||
{
|
{
|
||||||
stExpCocoNode *stChildNode = pCocoNode->GetChildArray();
|
stExpCocoNode *stChildNode = cocoNode->GetChildArray();
|
||||||
stExpCocoNode *actionNodeList = NULL;
|
stExpCocoNode *actionNodeList = NULL;
|
||||||
int count = pCocoNode->GetChildNum();
|
int count = cocoNode->GetChildNum();
|
||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
std::string key = stChildNode[i].GetName(pCocoLoader);
|
std::string key = stChildNode[i].GetName(cocoLoader);
|
||||||
std::string value = stChildNode[i].GetValue();
|
std::string value = stChildNode[i].GetValue();
|
||||||
if (key == "name") {
|
if (key == "name") {
|
||||||
setName(value.c_str());
|
setName(value.c_str());
|
||||||
|
@ -158,7 +158,7 @@ void ActionObject::initWithBinary(CocoLoader *pCocoLoader,
|
||||||
ActionNode* actionNode = new ActionNode();
|
ActionNode* actionNode = new ActionNode();
|
||||||
actionNode->autorelease();
|
actionNode->autorelease();
|
||||||
|
|
||||||
actionNode->initWithBinary(pCocoLoader, &actionNodeArray[i] , root);
|
actionNode->initWithBinary(cocoLoader, &actionNodeArray[i] , root);
|
||||||
|
|
||||||
actionNode->setUnitTime(getUnitTime());
|
actionNode->setUnitTime(getUnitTime());
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,7 @@ public:
|
||||||
/*init properties with a json dictionary*/
|
/*init properties with a json dictionary*/
|
||||||
void initWithDictionary(const rapidjson::Value& dic, cocos2d::Ref* root);
|
void initWithDictionary(const rapidjson::Value& dic, cocos2d::Ref* root);
|
||||||
|
|
||||||
void initWithBinary(CocoLoader* pCocoLoader, stExpCocoNode* pCocoNode, cocos2d::Ref* root);
|
void initWithBinary(CocoLoader* cocoLoader, stExpCocoNode* pCocoNode, cocos2d::Ref* root);
|
||||||
|
|
||||||
|
|
||||||
/*scheduler update function*/
|
/*scheduler update function*/
|
||||||
|
|
|
@ -1865,11 +1865,11 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ArmatureData* DataReaderHelper::decodeArmature(CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo)
|
ArmatureData* DataReaderHelper::decodeArmature(CocoLoader *cocoLoader, stExpCocoNode *cocoNode, DataInfo *dataInfo)
|
||||||
{
|
{
|
||||||
ArmatureData *armatureData = new ArmatureData();
|
ArmatureData *armatureData = new ArmatureData();
|
||||||
armatureData->init();
|
armatureData->init();
|
||||||
stExpCocoNode *pAramtureDataArray = pCocoNode->GetChildArray();
|
stExpCocoNode *pAramtureDataArray = cocoNode->GetChildArray();
|
||||||
const char *name = pAramtureDataArray[2].GetValue(); //DICTOOL->getStringValue_json(json, A_NAME);
|
const char *name = pAramtureDataArray[2].GetValue(); //DICTOOL->getStringValue_json(json, A_NAME);
|
||||||
if(name != NULL)
|
if(name != NULL)
|
||||||
{
|
{
|
||||||
|
@ -1886,7 +1886,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
{
|
{
|
||||||
//const rapidjson::Value &dic = DICTOOL->getSubDictionary_json(json, BONE_DATA, i); //json[BONE_DATA][i];
|
//const rapidjson::Value &dic = DICTOOL->getSubDictionary_json(json, BONE_DATA, i); //json[BONE_DATA][i];
|
||||||
child = &pBoneChildren[i];
|
child = &pBoneChildren[i];
|
||||||
BoneData *boneData = decodeBone(pCocoLoader, child, dataInfo);
|
BoneData *boneData = decodeBone(cocoLoader, child, dataInfo);
|
||||||
armatureData->addBoneData(boneData);
|
armatureData->addBoneData(boneData);
|
||||||
boneData->release();
|
boneData->release();
|
||||||
}
|
}
|
||||||
|
@ -1894,22 +1894,22 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
return armatureData;
|
return armatureData;
|
||||||
}
|
}
|
||||||
|
|
||||||
BoneData* DataReaderHelper::decodeBone(CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo)
|
BoneData* DataReaderHelper::decodeBone(CocoLoader *cocoLoader, stExpCocoNode *cocoNode, DataInfo *dataInfo)
|
||||||
{
|
{
|
||||||
BoneData *boneData = new BoneData();
|
BoneData *boneData = new BoneData();
|
||||||
boneData->init();
|
boneData->init();
|
||||||
|
|
||||||
decodeNode(boneData, pCocoLoader, pCocoNode, dataInfo);
|
decodeNode(boneData, cocoLoader, cocoNode, dataInfo);
|
||||||
|
|
||||||
int length = pCocoNode->GetChildNum();
|
int length = cocoNode->GetChildNum();
|
||||||
stExpCocoNode *pBoneChildren = pCocoNode->GetChildArray();
|
stExpCocoNode *pBoneChildren = cocoNode->GetChildArray();
|
||||||
stExpCocoNode* child;
|
stExpCocoNode* child;
|
||||||
const char *str = NULL;
|
const char *str = NULL;
|
||||||
std::string key;
|
std::string key;
|
||||||
for (int i = 0; i < length; ++i)
|
for (int i = 0; i < length; ++i)
|
||||||
{
|
{
|
||||||
child = &pBoneChildren[i];
|
child = &pBoneChildren[i];
|
||||||
key = child->GetName(pCocoLoader);
|
key = child->GetName(cocoLoader);
|
||||||
str = child->GetValue();
|
str = child->GetValue();
|
||||||
if (key.compare(A_NAME) == 0)
|
if (key.compare(A_NAME) == 0)
|
||||||
{
|
{
|
||||||
|
@ -1933,7 +1933,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
stExpCocoNode *pDisplayData = child->GetChildArray();
|
stExpCocoNode *pDisplayData = child->GetChildArray();
|
||||||
for (int ii = 0; ii < count; ++ii)
|
for (int ii = 0; ii < count; ++ii)
|
||||||
{
|
{
|
||||||
DisplayData *displayData = decodeBoneDisplay(pCocoLoader, &pDisplayData[ii], dataInfo);
|
DisplayData *displayData = decodeBoneDisplay(cocoLoader, &pDisplayData[ii], dataInfo);
|
||||||
if(displayData == NULL)
|
if(displayData == NULL)
|
||||||
continue;
|
continue;
|
||||||
boneData->addDisplayData(displayData);
|
boneData->addDisplayData(displayData);
|
||||||
|
@ -1945,13 +1945,13 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
return boneData;
|
return boneData;
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplayData* DataReaderHelper::decodeBoneDisplay(CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo)
|
DisplayData* DataReaderHelper::decodeBoneDisplay(CocoLoader *cocoLoader, stExpCocoNode *cocoNode, DataInfo *dataInfo)
|
||||||
{
|
{
|
||||||
stExpCocoNode* children = pCocoNode->GetChildArray();
|
stExpCocoNode* children = cocoNode->GetChildArray();
|
||||||
stExpCocoNode* child = &children[1];
|
stExpCocoNode* child = &children[1];
|
||||||
const char *str = NULL;
|
const char *str = NULL;
|
||||||
|
|
||||||
std::string key = child->GetName(pCocoLoader);
|
std::string key = child->GetName(cocoLoader);
|
||||||
str = child->GetValue();
|
str = child->GetValue();
|
||||||
DisplayData *displayData = NULL;
|
DisplayData *displayData = NULL;
|
||||||
if (key.compare(A_DISPLAY_TYPE) == 0)
|
if (key.compare(A_DISPLAY_TYPE) == 0)
|
||||||
|
@ -1982,7 +1982,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
stExpCocoNode *SkinDataValue = pSkinData->GetChildArray();
|
stExpCocoNode *SkinDataValue = pSkinData->GetChildArray();
|
||||||
for (int i = 0; i < length; ++i)
|
for (int i = 0; i < length; ++i)
|
||||||
{
|
{
|
||||||
key = SkinDataValue[i].GetName(pCocoLoader);
|
key = SkinDataValue[i].GetName(cocoLoader);
|
||||||
str = SkinDataValue[i].GetValue();
|
str = SkinDataValue[i].GetValue();
|
||||||
if (key.compare(A_X) == 0)
|
if (key.compare(A_X) == 0)
|
||||||
{
|
{
|
||||||
|
@ -2021,7 +2021,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
{
|
{
|
||||||
displayData = new ArmatureDisplayData();
|
displayData = new ArmatureDisplayData();
|
||||||
|
|
||||||
const char *name = pCocoNode[0].GetValue();
|
const char *name = cocoNode[0].GetValue();
|
||||||
if(name != NULL)
|
if(name != NULL)
|
||||||
{
|
{
|
||||||
((ArmatureDisplayData *)displayData)->displayName = name;
|
((ArmatureDisplayData *)displayData)->displayName = name;
|
||||||
|
@ -2031,11 +2031,11 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
case CS_DISPLAY_PARTICLE:
|
case CS_DISPLAY_PARTICLE:
|
||||||
{
|
{
|
||||||
displayData = new ParticleDisplayData();
|
displayData = new ParticleDisplayData();
|
||||||
length = pCocoNode->GetChildNum();
|
length = cocoNode->GetChildNum();
|
||||||
stExpCocoNode *pDisplayData = pCocoNode->GetChildArray();
|
stExpCocoNode *pDisplayData = cocoNode->GetChildArray();
|
||||||
for (int i = 0; i < length; ++i)
|
for (int i = 0; i < length; ++i)
|
||||||
{
|
{
|
||||||
key = pDisplayData[i].GetName(pCocoLoader);
|
key = pDisplayData[i].GetName(cocoLoader);
|
||||||
str = pDisplayData[i].GetValue();
|
str = pDisplayData[i].GetValue();
|
||||||
if (key.compare(A_PLIST) == 0)
|
if (key.compare(A_PLIST) == 0)
|
||||||
{
|
{
|
||||||
|
@ -2065,12 +2065,12 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
return displayData;
|
return displayData;
|
||||||
}
|
}
|
||||||
|
|
||||||
AnimationData* DataReaderHelper::decodeAnimation(CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo)
|
AnimationData* DataReaderHelper::decodeAnimation(CocoLoader *cocoLoader, stExpCocoNode *cocoNode, DataInfo *dataInfo)
|
||||||
{
|
{
|
||||||
AnimationData *aniData = new AnimationData();
|
AnimationData *aniData = new AnimationData();
|
||||||
|
|
||||||
int length = pCocoNode->GetChildNum();
|
int length = cocoNode->GetChildNum();
|
||||||
stExpCocoNode *pAnimationData = pCocoNode->GetChildArray();
|
stExpCocoNode *pAnimationData = cocoNode->GetChildArray();
|
||||||
const char *str = NULL;
|
const char *str = NULL;
|
||||||
std::string key;
|
std::string key;
|
||||||
stExpCocoNode* child;
|
stExpCocoNode* child;
|
||||||
|
@ -2078,7 +2078,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
for (int i = 0; i < length; ++i)
|
for (int i = 0; i < length; ++i)
|
||||||
{
|
{
|
||||||
child = &pAnimationData[i];
|
child = &pAnimationData[i];
|
||||||
key = child->GetName(pCocoLoader);
|
key = child->GetName(cocoLoader);
|
||||||
str = child->GetValue();
|
str = child->GetValue();
|
||||||
if (key.compare(A_NAME) == 0)
|
if (key.compare(A_NAME) == 0)
|
||||||
{
|
{
|
||||||
|
@ -2093,7 +2093,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
stExpCocoNode* movArray = child->GetChildArray();
|
stExpCocoNode* movArray = child->GetChildArray();
|
||||||
for( int movnum =0; movnum <movcount; movnum++)
|
for( int movnum =0; movnum <movcount; movnum++)
|
||||||
{
|
{
|
||||||
movementData = decodeMovement(pCocoLoader, &movArray[movnum], dataInfo);
|
movementData = decodeMovement(cocoLoader, &movArray[movnum], dataInfo);
|
||||||
aniData->addMovement(movementData);
|
aniData->addMovement(movementData);
|
||||||
movementData->release();
|
movementData->release();
|
||||||
}
|
}
|
||||||
|
@ -2102,13 +2102,13 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
return aniData;
|
return aniData;
|
||||||
}
|
}
|
||||||
|
|
||||||
MovementData* DataReaderHelper::decodeMovement(CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo)
|
MovementData* DataReaderHelper::decodeMovement(CocoLoader *cocoLoader, stExpCocoNode *cocoNode, DataInfo *dataInfo)
|
||||||
{
|
{
|
||||||
MovementData *movementData = new MovementData();
|
MovementData *movementData = new MovementData();
|
||||||
movementData->scale = 1.0f;
|
movementData->scale = 1.0f;
|
||||||
|
|
||||||
int length = pCocoNode->GetChildNum();
|
int length = cocoNode->GetChildNum();
|
||||||
stExpCocoNode *pMoveDataArray = pCocoNode->GetChildArray();
|
stExpCocoNode *pMoveDataArray = cocoNode->GetChildArray();
|
||||||
|
|
||||||
const char *str = NULL;
|
const char *str = NULL;
|
||||||
std::string key;
|
std::string key;
|
||||||
|
@ -2116,7 +2116,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
for (int i = 0; i < length; ++i)
|
for (int i = 0; i < length; ++i)
|
||||||
{
|
{
|
||||||
child = &pMoveDataArray[i];
|
child = &pMoveDataArray[i];
|
||||||
key = child->GetName(pCocoLoader);
|
key = child->GetName(cocoLoader);
|
||||||
str = child->GetValue();
|
str = child->GetValue();
|
||||||
if (key.compare(A_NAME) == 0)
|
if (key.compare(A_NAME) == 0)
|
||||||
{
|
{
|
||||||
|
@ -2183,7 +2183,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
MovementBoneData *movementBoneData;
|
MovementBoneData *movementBoneData;
|
||||||
for (int ii = 0; ii < count; ++ii)
|
for (int ii = 0; ii < count; ++ii)
|
||||||
{
|
{
|
||||||
movementBoneData = decodeMovementBone(pCocoLoader, &pMoveBoneData[ii],dataInfo);
|
movementBoneData = decodeMovementBone(cocoLoader, &pMoveBoneData[ii],dataInfo);
|
||||||
movementData->addMovementBoneData(movementBoneData);
|
movementData->addMovementBoneData(movementBoneData);
|
||||||
movementBoneData->release();
|
movementBoneData->release();
|
||||||
}
|
}
|
||||||
|
@ -2192,19 +2192,19 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
return movementData;
|
return movementData;
|
||||||
}
|
}
|
||||||
|
|
||||||
MovementBoneData* DataReaderHelper::decodeMovementBone(CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo)
|
MovementBoneData* DataReaderHelper::decodeMovementBone(CocoLoader *cocoLoader, stExpCocoNode *cocoNode, DataInfo *dataInfo)
|
||||||
{
|
{
|
||||||
MovementBoneData *movementBoneData = new MovementBoneData();
|
MovementBoneData *movementBoneData = new MovementBoneData();
|
||||||
movementBoneData->init();
|
movementBoneData->init();
|
||||||
|
|
||||||
int length = pCocoNode->GetChildNum();
|
int length = cocoNode->GetChildNum();
|
||||||
stExpCocoNode *pMovementBoneDataArray = pCocoNode->GetChildArray();
|
stExpCocoNode *pMovementBoneDataArray = cocoNode->GetChildArray();
|
||||||
stExpCocoNode* movebonechild;
|
stExpCocoNode* movebonechild;
|
||||||
const char *str = NULL;
|
const char *str = NULL;
|
||||||
for (int i = 0; i < length; ++i)
|
for (int i = 0; i < length; ++i)
|
||||||
{
|
{
|
||||||
movebonechild = &pMovementBoneDataArray[i];
|
movebonechild = &pMovementBoneDataArray[i];
|
||||||
std::string key = movebonechild->GetName(pCocoLoader);
|
std::string key = movebonechild->GetName(cocoLoader);
|
||||||
str = movebonechild->GetValue();
|
str = movebonechild->GetValue();
|
||||||
if (key.compare(A_NAME) == 0)
|
if (key.compare(A_NAME) == 0)
|
||||||
{
|
{
|
||||||
|
@ -2226,7 +2226,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
stExpCocoNode *pFrameDataArray = movebonechild->GetChildArray();
|
stExpCocoNode *pFrameDataArray = movebonechild->GetChildArray();
|
||||||
for (int ii = 0; ii < count; ++ii)
|
for (int ii = 0; ii < count; ++ii)
|
||||||
{
|
{
|
||||||
FrameData *frameData = decodeFrame(pCocoLoader, &pFrameDataArray[ii], dataInfo);
|
FrameData *frameData = decodeFrame(cocoLoader, &pFrameDataArray[ii], dataInfo);
|
||||||
movementBoneData->addFrameData(frameData);
|
movementBoneData->addFrameData(frameData);
|
||||||
frameData->release();
|
frameData->release();
|
||||||
|
|
||||||
|
@ -2286,18 +2286,18 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
return movementBoneData;
|
return movementBoneData;
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameData* DataReaderHelper::decodeFrame(CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo)
|
FrameData* DataReaderHelper::decodeFrame(CocoLoader *cocoLoader, stExpCocoNode *cocoNode, DataInfo *dataInfo)
|
||||||
{
|
{
|
||||||
FrameData *frameData = new FrameData();
|
FrameData *frameData = new FrameData();
|
||||||
|
|
||||||
decodeNode(frameData, pCocoLoader, pCocoNode, dataInfo);
|
decodeNode(frameData, cocoLoader, cocoNode, dataInfo);
|
||||||
|
|
||||||
int length = pCocoNode->GetChildNum();
|
int length = cocoNode->GetChildNum();
|
||||||
stExpCocoNode *pFrameDataArray = pCocoNode->GetChildArray();
|
stExpCocoNode *pFrameDataArray = cocoNode->GetChildArray();
|
||||||
const char *str = NULL;
|
const char *str = NULL;
|
||||||
for (int i = 0; i < length; ++i)
|
for (int i = 0; i < length; ++i)
|
||||||
{
|
{
|
||||||
std::string key = pFrameDataArray[i].GetName(pCocoLoader);
|
std::string key = pFrameDataArray[i].GetName(cocoLoader);
|
||||||
str = pFrameDataArray[i].GetValue();
|
str = pFrameDataArray[i].GetValue();
|
||||||
if (key.compare(A_TWEEN_EASING) == 0)
|
if (key.compare(A_TWEEN_EASING) == 0)
|
||||||
{
|
{
|
||||||
|
@ -2390,33 +2390,33 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
return frameData;
|
return frameData;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureData* DataReaderHelper::decodeTexture(CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode)
|
TextureData* DataReaderHelper::decodeTexture(CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
|
||||||
{
|
{
|
||||||
TextureData *textureData = new TextureData();
|
TextureData *textureData = new TextureData();
|
||||||
textureData->init();
|
textureData->init();
|
||||||
|
|
||||||
if(pCocoNode == NULL)
|
if(cocoNode == nullptr)
|
||||||
{
|
{
|
||||||
return textureData;
|
return textureData;
|
||||||
}
|
}
|
||||||
|
|
||||||
int length = pCocoNode->GetChildNum();
|
int length = cocoNode->GetChildNum();
|
||||||
stExpCocoNode *pTextureDataArray = pCocoNode->GetChildArray();
|
stExpCocoNode *pTextureDataArray = cocoNode->GetChildArray();
|
||||||
const char *str = NULL;
|
const char *str = nullptr;
|
||||||
for (int i = 0; i < length; ++i)
|
for (int i = 0; i < length; ++i)
|
||||||
{
|
{
|
||||||
std::string key = pTextureDataArray[i].GetName(pCocoLoader);
|
std::string key = pTextureDataArray[i].GetName(cocoLoader);
|
||||||
str = pTextureDataArray[i].GetValue();
|
str = pTextureDataArray[i].GetValue();
|
||||||
if (key.compare(A_NAME) == 0)
|
if (key.compare(A_NAME) == 0)
|
||||||
{
|
{
|
||||||
if(str != NULL)
|
if(str != nullptr)
|
||||||
{
|
{
|
||||||
textureData->name = str;
|
textureData->name = str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (key.compare(A_WIDTH) == 0)
|
else if (key.compare(A_WIDTH) == 0)
|
||||||
{
|
{
|
||||||
if(str != NULL)
|
if(str != nullptr)
|
||||||
{
|
{
|
||||||
textureData->width = atof(str);
|
textureData->width = atof(str);
|
||||||
}
|
}
|
||||||
|
@ -2448,7 +2448,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
stExpCocoNode *pContourArray = pTextureDataArray[i].GetChildArray();
|
stExpCocoNode *pContourArray = pTextureDataArray[i].GetChildArray();
|
||||||
for (int ii = 0; ii < count; ++ii)
|
for (int ii = 0; ii < count; ++ii)
|
||||||
{
|
{
|
||||||
ContourData *contourData = decodeContour(pCocoLoader, &pContourArray[ii]);
|
ContourData *contourData = decodeContour(cocoLoader, &pContourArray[ii]);
|
||||||
textureData->contourDataList.pushBack(contourData);
|
textureData->contourDataList.pushBack(contourData);
|
||||||
contourData->release();
|
contourData->release();
|
||||||
}
|
}
|
||||||
|
@ -2457,17 +2457,17 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
return textureData;
|
return textureData;
|
||||||
}
|
}
|
||||||
|
|
||||||
ContourData* DataReaderHelper::decodeContour(CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode)
|
ContourData* DataReaderHelper::decodeContour(CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
|
||||||
{
|
{
|
||||||
ContourData *contourData = new ContourData();
|
ContourData *contourData = new ContourData();
|
||||||
contourData->init();
|
contourData->init();
|
||||||
|
|
||||||
int length = pCocoNode->GetChildNum();
|
int length = cocoNode->GetChildNum();
|
||||||
stExpCocoNode *verTexPointArray = pCocoNode->GetChildArray();
|
stExpCocoNode *verTexPointArray = cocoNode->GetChildArray();
|
||||||
const char *str = NULL;
|
const char *str = nullptr;
|
||||||
for (int i = 0; i < length; ++i)
|
for (int i = 0; i < length; ++i)
|
||||||
{
|
{
|
||||||
std::string key = verTexPointArray[i].GetName(pCocoLoader);
|
std::string key = verTexPointArray[i].GetName(cocoLoader);
|
||||||
str = verTexPointArray[i].GetValue();
|
str = verTexPointArray[i].GetValue();
|
||||||
if (key.compare(VERTEX_POINT) == 0)
|
if (key.compare(VERTEX_POINT) == 0)
|
||||||
{
|
{
|
||||||
|
@ -2487,10 +2487,10 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
return contourData;
|
return contourData;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataReaderHelper::decodeNode(BaseData *node, CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo)
|
void DataReaderHelper::decodeNode(BaseData *node, CocoLoader *cocoLoader, stExpCocoNode* cocoNode, DataInfo *dataInfo)
|
||||||
{
|
{
|
||||||
int length = pCocoNode->GetChildNum();
|
int length = cocoNode->GetChildNum();
|
||||||
stExpCocoNode *NodeArray = pCocoNode->GetChildArray();
|
stExpCocoNode *NodeArray = cocoNode->GetChildArray();
|
||||||
const char *str = NULL;
|
const char *str = NULL;
|
||||||
|
|
||||||
bool isVersionL = dataInfo->cocoStudioVersion < VERSION_COLOR_READING;
|
bool isVersionL = dataInfo->cocoStudioVersion < VERSION_COLOR_READING;
|
||||||
|
@ -2498,7 +2498,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
for (int i = 0; i < length; ++i)
|
for (int i = 0; i < length; ++i)
|
||||||
{
|
{
|
||||||
child = &NodeArray[i];
|
child = &NodeArray[i];
|
||||||
std::string key = child->GetName(pCocoLoader);
|
std::string key = child->GetName(cocoLoader);
|
||||||
str = child->GetValue();
|
str = child->GetValue();
|
||||||
if (key.compare(A_X) == 0)
|
if (key.compare(A_X) == 0)
|
||||||
{
|
{
|
||||||
|
@ -2532,7 +2532,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
{
|
{
|
||||||
if (!isVersionL)
|
if (!isVersionL)
|
||||||
{
|
{
|
||||||
if (child->GetType(pCocoLoader) == rapidjson::kObjectType)
|
if (child->GetType(cocoLoader) == rapidjson::kObjectType)
|
||||||
{
|
{
|
||||||
if(child->GetChildNum() == 4)
|
if(child->GetChildNum() == 4)
|
||||||
{
|
{
|
||||||
|
@ -2559,7 +2559,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
if(colorcoount>0)
|
if(colorcoount>0)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (NodeArray[0].GetType(pCocoLoader) == rapidjson::kObjectType)
|
if (NodeArray[0].GetType(cocoLoader) == rapidjson::kObjectType)
|
||||||
{
|
{
|
||||||
if(NodeArray[0].GetChildNum() == 4)
|
if(NodeArray[0].GetChildNum() == 4)
|
||||||
{
|
{
|
||||||
|
|
|
@ -180,19 +180,19 @@ public:
|
||||||
// for binary decode
|
// for binary decode
|
||||||
public:
|
public:
|
||||||
static void addDataFromBinaryCache(const char *fileContent, DataInfo *dataInfo = NULL);
|
static void addDataFromBinaryCache(const char *fileContent, DataInfo *dataInfo = NULL);
|
||||||
static ArmatureData *decodeArmature(CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
|
static ArmatureData *decodeArmature(CocoLoader *cocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
|
||||||
static BoneData *decodeBone(CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
|
static BoneData *decodeBone(CocoLoader *cocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
|
||||||
static DisplayData *decodeBoneDisplay(CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
|
static DisplayData *decodeBoneDisplay(CocoLoader *cocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
|
||||||
static AnimationData *decodeAnimation(CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
|
static AnimationData *decodeAnimation(CocoLoader *cocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
|
||||||
static MovementData *decodeMovement(CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
|
static MovementData *decodeMovement(CocoLoader *cocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
|
||||||
|
|
||||||
static MovementBoneData *decodeMovementBone(CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
|
static MovementBoneData *decodeMovementBone(CocoLoader *cocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
|
||||||
static FrameData *decodeFrame(CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
|
static FrameData *decodeFrame(CocoLoader *cocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
|
||||||
|
|
||||||
static TextureData *decodeTexture(CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode);
|
static TextureData *decodeTexture(CocoLoader *cocoLoader, stExpCocoNode *pCocoNode);
|
||||||
static ContourData *decodeContour(CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode);
|
static ContourData *decodeContour(CocoLoader *cocoLoader, stExpCocoNode *pCocoNode);
|
||||||
|
|
||||||
static void decodeNode(BaseData *node, CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
|
static void decodeNode(BaseData *node, CocoLoader *cocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void loadData();
|
void loadData();
|
||||||
|
|
|
@ -1218,17 +1218,17 @@ Widget* WidgetPropertiesReader0300::createWidget(const rapidjson::Value& data, c
|
||||||
return widget;
|
return widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
cocos2d::ui::Widget* WidgetPropertiesReader0300::createWidgetFromBinary(CocoLoader* pCocoLoader,stExpCocoNode* pCocoNode, const char* fileName)
|
cocos2d::ui::Widget* WidgetPropertiesReader0300::createWidgetFromBinary(CocoLoader* cocoLoader,stExpCocoNode* cocoNode, const char* fileName)
|
||||||
{
|
{
|
||||||
|
|
||||||
stExpCocoNode *tpChildArray = pCocoNode->GetChildArray();
|
stExpCocoNode *tpChildArray = cocoNode->GetChildArray();
|
||||||
float fileDesignWidth;
|
float fileDesignWidth;
|
||||||
float fileDesignHeight;
|
float fileDesignHeight;
|
||||||
|
|
||||||
Widget* widget = nullptr;
|
Widget* widget = nullptr;
|
||||||
|
|
||||||
for (int i = 0; i < pCocoNode->GetChildNum(); ++i) {
|
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
|
||||||
std::string key = tpChildArray[i].GetName(pCocoLoader);
|
std::string key = tpChildArray[i].GetName(cocoLoader);
|
||||||
|
|
||||||
if (key == "textures") {
|
if (key == "textures") {
|
||||||
int texturesCount = tpChildArray[i].GetChildNum();
|
int texturesCount = tpChildArray[i].GetChildNum();
|
||||||
|
@ -1257,11 +1257,11 @@ Widget* WidgetPropertiesReader0300::createWidget(const rapidjson::Value& data, c
|
||||||
|
|
||||||
|
|
||||||
stExpCocoNode *widgetTreeNode = &tpChildArray[i];
|
stExpCocoNode *widgetTreeNode = &tpChildArray[i];
|
||||||
rapidjson::Type tType = tpChildArray[i].GetType(pCocoLoader);
|
rapidjson::Type tType = tpChildArray[i].GetType(cocoLoader);
|
||||||
|
|
||||||
if (rapidjson::kObjectType == tType)
|
if (rapidjson::kObjectType == tType)
|
||||||
{
|
{
|
||||||
widget = widgetFromBinary(pCocoLoader, widgetTreeNode);
|
widget = widgetFromBinary(cocoLoader, widgetTreeNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (widget->getContentSize().equals(Size::ZERO))
|
if (widget->getContentSize().equals(Size::ZERO))
|
||||||
|
@ -1274,12 +1274,12 @@ Widget* WidgetPropertiesReader0300::createWidget(const rapidjson::Value& data, c
|
||||||
|
|
||||||
/* ********************** */
|
/* ********************** */
|
||||||
/* ********************** */
|
/* ********************** */
|
||||||
stExpCocoNode *optionChildNode = pCocoNode->GetChildArray();
|
stExpCocoNode *optionChildNode = cocoNode->GetChildArray();
|
||||||
for (int k = 0; k < pCocoNode->GetChildNum(); ++k) {
|
for (int k = 0; k < cocoNode->GetChildNum(); ++k) {
|
||||||
std::string key = optionChildNode[k].GetName(pCocoLoader);
|
std::string key = optionChildNode[k].GetName(cocoLoader);
|
||||||
if (key == "animation") {
|
if (key == "animation") {
|
||||||
Ref* rootWidget = (Ref*) widget;
|
Ref* rootWidget = (Ref*) widget;
|
||||||
ActionManagerEx::getInstance()->initWithBinary(fileName,rootWidget,pCocoLoader, &optionChildNode[k]);
|
ActionManagerEx::getInstance()->initWithBinary(fileName,rootWidget,cocoLoader, &optionChildNode[k]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1287,17 +1287,17 @@ Widget* WidgetPropertiesReader0300::createWidget(const rapidjson::Value& data, c
|
||||||
return widget;
|
return widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget* WidgetPropertiesReader0300::widgetFromBinary(CocoLoader* pCocoLoader, stExpCocoNode* pCocoNode)
|
Widget* WidgetPropertiesReader0300::widgetFromBinary(CocoLoader* cocoLoader, stExpCocoNode* cocoNode)
|
||||||
{
|
{
|
||||||
Widget* widget = nullptr;
|
Widget* widget = nullptr;
|
||||||
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
|
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
|
||||||
stExpCocoNode *optionsNode = nullptr;
|
stExpCocoNode *optionsNode = nullptr;
|
||||||
stExpCocoNode *childrenNode = nullptr;
|
stExpCocoNode *childrenNode = nullptr;
|
||||||
int elementCount = pCocoNode->GetChildNum();
|
int elementCount = cocoNode->GetChildNum();
|
||||||
std::string classname;
|
std::string classname;
|
||||||
|
|
||||||
for (int i = 0; i < elementCount; ++i) {
|
for (int i = 0; i < elementCount; ++i) {
|
||||||
std::string key = stChildArray[i].GetName(pCocoLoader);
|
std::string key = stChildArray[i].GetName(cocoLoader);
|
||||||
std::string value = stChildArray[i].GetValue();
|
std::string value = stChildArray[i].GetValue();
|
||||||
|
|
||||||
if (key == "classname" )
|
if (key == "classname" )
|
||||||
|
@ -1326,7 +1326,7 @@ Widget* WidgetPropertiesReader0300::widgetFromBinary(CocoLoader* pCocoLoader, s
|
||||||
if (reader)
|
if (reader)
|
||||||
{
|
{
|
||||||
// widget parse with widget reader
|
// widget parse with widget reader
|
||||||
setPropsForAllWidgetFromBinary(reader, widget, pCocoLoader,optionsNode);
|
setPropsForAllWidgetFromBinary(reader, widget, cocoLoader,optionsNode);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1336,13 +1336,13 @@ Widget* WidgetPropertiesReader0300::widgetFromBinary(CocoLoader* pCocoLoader, s
|
||||||
|
|
||||||
|
|
||||||
if (reader && widget) {
|
if (reader && widget) {
|
||||||
setPropsForAllWidgetFromBinary(reader, widget, pCocoLoader, optionsNode);
|
setPropsForAllWidgetFromBinary(reader, widget, cocoLoader, optionsNode);
|
||||||
// 2nd., custom widget parse with custom reader
|
// 2nd., custom widget parse with custom reader
|
||||||
//2nd. parse custom property
|
//2nd. parse custom property
|
||||||
const char* customProperty = NULL;
|
const char* customProperty = NULL;
|
||||||
stExpCocoNode *optionChildNode = optionsNode->GetChildArray();
|
stExpCocoNode *optionChildNode = optionsNode->GetChildArray();
|
||||||
for (int k = 0; k < optionsNode->GetChildNum(); ++k) {
|
for (int k = 0; k < optionsNode->GetChildNum(); ++k) {
|
||||||
std::string key = optionChildNode[k].GetName(pCocoLoader);
|
std::string key = optionChildNode[k].GetName(cocoLoader);
|
||||||
if (key == "customProperty") {
|
if (key == "customProperty") {
|
||||||
customProperty = optionChildNode[k].GetValue();
|
customProperty = optionChildNode[k].GetValue();
|
||||||
break;
|
break;
|
||||||
|
@ -1364,17 +1364,17 @@ Widget* WidgetPropertiesReader0300::widgetFromBinary(CocoLoader* pCocoLoader, s
|
||||||
|
|
||||||
//parse children
|
//parse children
|
||||||
if (nullptr != childrenNode) {
|
if (nullptr != childrenNode) {
|
||||||
rapidjson::Type tType22 = childrenNode->GetType(pCocoLoader);
|
rapidjson::Type tType22 = childrenNode->GetType(cocoLoader);
|
||||||
if (tType22 == rapidjson::kArrayType) {
|
if (tType22 == rapidjson::kArrayType) {
|
||||||
|
|
||||||
int childrenCount = childrenNode->GetChildNum();
|
int childrenCount = childrenNode->GetChildNum();
|
||||||
stExpCocoNode* innerChildArray = childrenNode->GetChildArray();
|
stExpCocoNode* innerChildArray = childrenNode->GetChildArray();
|
||||||
for (int i=0; i < childrenCount; ++i) {
|
for (int i=0; i < childrenCount; ++i) {
|
||||||
rapidjson::Type tType = innerChildArray[i].GetType(pCocoLoader);
|
rapidjson::Type tType = innerChildArray[i].GetType(cocoLoader);
|
||||||
|
|
||||||
if (tType == rapidjson::kObjectType) {
|
if (tType == rapidjson::kObjectType) {
|
||||||
|
|
||||||
Widget *child = widgetFromBinary(pCocoLoader, &innerChildArray[i]);
|
Widget *child = widgetFromBinary(cocoLoader, &innerChildArray[i]);
|
||||||
|
|
||||||
if (child)
|
if (child)
|
||||||
{
|
{
|
||||||
|
@ -1417,10 +1417,10 @@ Widget* WidgetPropertiesReader0300::widgetFromBinary(CocoLoader* pCocoLoader, s
|
||||||
|
|
||||||
void WidgetPropertiesReader0300::setPropsForAllWidgetFromBinary(WidgetReaderProtocol* reader,
|
void WidgetPropertiesReader0300::setPropsForAllWidgetFromBinary(WidgetReaderProtocol* reader,
|
||||||
cocos2d::ui::Widget* widget,
|
cocos2d::ui::Widget* widget,
|
||||||
CocoLoader* pCocoLoader,
|
CocoLoader* cocoLoader,
|
||||||
stExpCocoNode* pCocoNode)
|
stExpCocoNode* cocoNode)
|
||||||
{
|
{
|
||||||
reader->setPropsFromBinary(widget, pCocoLoader, pCocoNode);
|
reader->setPropsFromBinary(widget, cocoLoader, cocoNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -104,16 +104,16 @@ public:
|
||||||
const rapidjson::Value& customOptions) = 0;
|
const rapidjson::Value& customOptions) = 0;
|
||||||
|
|
||||||
//add binary parsing
|
//add binary parsing
|
||||||
virtual cocos2d::ui::Widget* createWidgetFromBinary(CocoLoader* pCocoLoader,stExpCocoNode* pCocoNode, const char* fileName)=0;
|
virtual cocos2d::ui::Widget* createWidgetFromBinary(CocoLoader* cocoLoader,stExpCocoNode* pCocoNode, const char* fileName)=0;
|
||||||
virtual cocos2d::ui::Widget* widgetFromBinary(CocoLoader* pCocoLoader, stExpCocoNode* pCocoNode) = 0;
|
virtual cocos2d::ui::Widget* widgetFromBinary(CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) = 0;
|
||||||
virtual void setPropsForAllWidgetFromBinary(WidgetReaderProtocol* reader,
|
virtual void setPropsForAllWidgetFromBinary(WidgetReaderProtocol* reader,
|
||||||
cocos2d::ui::Widget* widget,
|
cocos2d::ui::Widget* widget,
|
||||||
CocoLoader* pCocoLoader,
|
CocoLoader* cocoLoader,
|
||||||
stExpCocoNode* pCocoNode) = 0;
|
stExpCocoNode* pCocoNode) = 0;
|
||||||
|
|
||||||
virtual void setPropsForAllCustomWidgetFromBinary(const std::string& classType,
|
virtual void setPropsForAllCustomWidgetFromBinary(const std::string& classType,
|
||||||
cocos2d::ui::Widget* widget,
|
cocos2d::ui::Widget* widget,
|
||||||
CocoLoader* pCocoLoader,
|
CocoLoader* cocoLoader,
|
||||||
stExpCocoNode* pCocoNode) = 0;
|
stExpCocoNode* pCocoNode) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -143,21 +143,21 @@ public:
|
||||||
virtual cocos2d::ui::Widget* widgetFromJsonDictionary(const rapidjson::Value& dic);
|
virtual cocos2d::ui::Widget* widgetFromJsonDictionary(const rapidjson::Value& dic);
|
||||||
|
|
||||||
//added for binary parsing
|
//added for binary parsing
|
||||||
virtual cocos2d::ui::Widget* createWidgetFromBinary(CocoLoader* pCocoLoader,
|
virtual cocos2d::ui::Widget* createWidgetFromBinary(CocoLoader* cocoLoader,
|
||||||
stExpCocoNode* pCocoNode,
|
stExpCocoNode* pCocoNode,
|
||||||
const char* fileName)override{return nullptr;}
|
const char* fileName)override{return nullptr;}
|
||||||
|
|
||||||
virtual cocos2d::ui::Widget* widgetFromBinary(CocoLoader* pCocoLoader,
|
virtual cocos2d::ui::Widget* widgetFromBinary(CocoLoader* cocoLoader,
|
||||||
stExpCocoNode* pCocoNode){return nullptr;}
|
stExpCocoNode* pCocoNode){return nullptr;}
|
||||||
|
|
||||||
virtual void setPropsForAllWidgetFromBinary(WidgetReaderProtocol* reader,
|
virtual void setPropsForAllWidgetFromBinary(WidgetReaderProtocol* reader,
|
||||||
cocos2d::ui::Widget* widget,
|
cocos2d::ui::Widget* widget,
|
||||||
CocoLoader* pCocoLoader,
|
CocoLoader* cocoLoader,
|
||||||
stExpCocoNode* pCocoNode) {}
|
stExpCocoNode* pCocoNode) {}
|
||||||
|
|
||||||
virtual void setPropsForAllCustomWidgetFromBinary(const std::string& classType,
|
virtual void setPropsForAllCustomWidgetFromBinary(const std::string& classType,
|
||||||
cocos2d::ui::Widget* widget,
|
cocos2d::ui::Widget* widget,
|
||||||
CocoLoader* pCocoLoader,
|
CocoLoader* cocoLoader,
|
||||||
stExpCocoNode* pCocoNode) {}
|
stExpCocoNode* pCocoNode) {}
|
||||||
|
|
||||||
virtual void setPropsForWidgetFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options);
|
virtual void setPropsForWidgetFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options);
|
||||||
|
@ -196,21 +196,21 @@ public:
|
||||||
|
|
||||||
|
|
||||||
//add bin parse support
|
//add bin parse support
|
||||||
virtual cocos2d::ui::Widget* createWidgetFromBinary(CocoLoader* pCocoLoader,
|
virtual cocos2d::ui::Widget* createWidgetFromBinary(CocoLoader* cocoLoader,
|
||||||
stExpCocoNode* pCocoNode,
|
stExpCocoNode* pCocoNode,
|
||||||
const char* fileName)override;
|
const char* fileName)override;
|
||||||
|
|
||||||
virtual cocos2d::ui::Widget* widgetFromBinary(CocoLoader* pCocoLoader,
|
virtual cocos2d::ui::Widget* widgetFromBinary(CocoLoader* cocoLoader,
|
||||||
stExpCocoNode* pCocoNode);
|
stExpCocoNode* pCocoNode);
|
||||||
|
|
||||||
virtual void setPropsForAllWidgetFromBinary(WidgetReaderProtocol* reader,
|
virtual void setPropsForAllWidgetFromBinary(WidgetReaderProtocol* reader,
|
||||||
cocos2d::ui::Widget* widget,
|
cocos2d::ui::Widget* widget,
|
||||||
CocoLoader* pCocoLoader,
|
CocoLoader* cocoLoader,
|
||||||
stExpCocoNode* pCocoNode);
|
stExpCocoNode* pCocoNode);
|
||||||
|
|
||||||
virtual void setPropsForAllCustomWidgetFromBinary(const std::string& classType,
|
virtual void setPropsForAllCustomWidgetFromBinary(const std::string& classType,
|
||||||
cocos2d::ui::Widget* widget,
|
cocos2d::ui::Widget* widget,
|
||||||
CocoLoader* pCocoLoader,
|
CocoLoader* cocoLoader,
|
||||||
stExpCocoNode* pCocoNode) {
|
stExpCocoNode* pCocoNode) {
|
||||||
//TODO: custom property
|
//TODO: custom property
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,19 +122,19 @@ stExpCocoNode* stExpCocoNode::GetChildArray()
|
||||||
return (stExpCocoNode*)m_ChildArray;
|
return (stExpCocoNode*)m_ChildArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
void stExpCocoNode::ReBuild(char* pCocoNodeAddr,char* pStringMemoryAddr)
|
void stExpCocoNode::ReBuild(char* cocoNodeAddr,char* pStringMemoryAddr)
|
||||||
{
|
{
|
||||||
m_szValue = m_szValue + (uint64_t)pStringMemoryAddr;
|
m_szValue = m_szValue + (uint64_t)pStringMemoryAddr;
|
||||||
if( -1 == m_AttribIndex )
|
if( -1 == m_AttribIndex )
|
||||||
{
|
{
|
||||||
if(m_ChildNum > 0)
|
if(m_ChildNum > 0)
|
||||||
{
|
{
|
||||||
m_ChildArray = m_ChildArray + (uint64_t)pCocoNodeAddr;
|
m_ChildArray = m_ChildArray + (uint64_t)cocoNodeAddr;
|
||||||
|
|
||||||
stExpCocoNode* tpChildArray = (stExpCocoNode*)m_ChildArray;
|
stExpCocoNode* tpChildArray = (stExpCocoNode*)m_ChildArray;
|
||||||
for(int i = 0 ; i < m_ChildNum ; i++)
|
for(int i = 0 ; i < m_ChildNum ; i++)
|
||||||
{
|
{
|
||||||
tpChildArray[i].ReBuild(pCocoNodeAddr,pStringMemoryAddr);
|
tpChildArray[i].ReBuild(cocoNodeAddr,pStringMemoryAddr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ public:
|
||||||
stExpCocoNode* GetChildArray();
|
stExpCocoNode* GetChildArray();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline void ReBuild(char* pCocoNodeAddr,char* pStringMemoryAddr);
|
inline void ReBuild(char* cocoNodeAddr,char* pStringMemoryAddr);
|
||||||
void WriteJson(CocoLoader* pCoco, void* pFileName = NULL, int vLayer = 0, bool bEndNode = false, bool bParentNodeIsArray = false);
|
void WriteJson(CocoLoader* pCoco, void* pFileName = NULL, int vLayer = 0, bool bEndNode = false, bool bParentNodeIsArray = false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -57,21 +57,21 @@ namespace cocostudio
|
||||||
CC_SAFE_DELETE(instanceButtonReader);
|
CC_SAFE_DELETE(instanceButtonReader);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ButtonReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode)
|
void ButtonReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
|
||||||
{
|
{
|
||||||
WidgetReader::setPropsFromBinary(widget, pCocoLoader, pCocoNode);
|
WidgetReader::setPropsFromBinary(widget, cocoLoader, cocoNode);
|
||||||
|
|
||||||
Button *button = static_cast<Button*>(widget);
|
Button *button = static_cast<Button*>(widget);
|
||||||
|
|
||||||
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
|
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
|
||||||
|
|
||||||
this->beginSetBasicProperties(widget);
|
this->beginSetBasicProperties(widget);
|
||||||
|
|
||||||
float capsx = 0.0f, capsy = 0.0, capsWidth = 0.0, capsHeight = 0.0f;
|
float capsx = 0.0f, capsy = 0.0, capsWidth = 0.0, capsHeight = 0.0f;
|
||||||
int cri = 255, cgi = 255, cbi = 255;
|
int cri = 255, cgi = 255, cbi = 255;
|
||||||
float scale9Width = 0.0f, scale9Height = 0.0f;
|
float scale9Width = 0.0f, scale9Height = 0.0f;
|
||||||
for (int i = 0; i < pCocoNode->GetChildNum(); ++i) {
|
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
|
||||||
std::string key = stChildArray[i].GetName(pCocoLoader);
|
std::string key = stChildArray[i].GetName(cocoLoader);
|
||||||
std::string value = stChildArray[i].GetValue();
|
std::string value = stChildArray[i].GetValue();
|
||||||
// CCLOG("Button: key = %s, value = %d", key.c_str(), i);
|
// CCLOG("Button: key = %s, value = %d", key.c_str(), i);
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ namespace cocostudio
|
||||||
|
|
||||||
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
std::string backgroundValue = this->getResourcePath(pCocoLoader, &stChildArray[i], imageFileNameType);
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
button->loadTextureNormal(backgroundValue, imageFileNameType);
|
button->loadTextureNormal(backgroundValue, imageFileNameType);
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ namespace cocostudio
|
||||||
|
|
||||||
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
std::string backgroundValue = this->getResourcePath(pCocoLoader, &stChildArray[i], imageFileNameType);
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
button->loadTexturePressed(backgroundValue, imageFileNameType);
|
button->loadTexturePressed(backgroundValue, imageFileNameType);
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ namespace cocostudio
|
||||||
|
|
||||||
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
std::string backgroundValue = this->getResourcePath(pCocoLoader, &stChildArray[i], imageFileNameType);
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
button->loadTextureDisabled(backgroundValue, imageFileNameType);
|
button->loadTextureDisabled(backgroundValue, imageFileNameType);
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace cocostudio
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget,
|
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget,
|
||||||
const rapidjson::Value& options);
|
const rapidjson::Value& options);
|
||||||
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* pCocoLoader, stExpCocoNode* pCocoNode);
|
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode);
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,15 +38,15 @@ namespace cocostudio
|
||||||
return instanceCheckBoxReader;
|
return instanceCheckBoxReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckBoxReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode)
|
void CheckBoxReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
|
||||||
{
|
{
|
||||||
|
|
||||||
CheckBox *checkBox = static_cast<CheckBox*>(widget);
|
CheckBox *checkBox = static_cast<CheckBox*>(widget);
|
||||||
this->beginSetBasicProperties(widget);
|
this->beginSetBasicProperties(widget);
|
||||||
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
|
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
|
||||||
|
|
||||||
for (int i = 0; i < pCocoNode->GetChildNum(); ++i) {
|
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
|
||||||
std::string key = stChildArray[i].GetName(pCocoLoader);
|
std::string key = stChildArray[i].GetName(cocoLoader);
|
||||||
std::string value = stChildArray[i].GetValue();
|
std::string value = stChildArray[i].GetValue();
|
||||||
// CCLOG("key = %s, index : %d", key.c_str(), i);
|
// CCLOG("key = %s, index : %d", key.c_str(), i);
|
||||||
//read all basic properties of widget
|
//read all basic properties of widget
|
||||||
|
@ -61,7 +61,7 @@ namespace cocostudio
|
||||||
|
|
||||||
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
std::string backgroundValue = this->getResourcePath(pCocoLoader, &stChildArray[i], imageFileNameType);
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
checkBox->loadTextureBackGround(backgroundValue, imageFileNameType);
|
checkBox->loadTextureBackGround(backgroundValue, imageFileNameType);
|
||||||
}else if(key == P_BackGroundBoxSelectedData){
|
}else if(key == P_BackGroundBoxSelectedData){
|
||||||
|
@ -70,7 +70,7 @@ namespace cocostudio
|
||||||
|
|
||||||
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
std::string backgroundValue = this->getResourcePath(pCocoLoader, &stChildArray[i], imageFileNameType);
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
checkBox->loadTextureBackGroundSelected(backgroundValue, imageFileNameType);
|
checkBox->loadTextureBackGroundSelected(backgroundValue, imageFileNameType);
|
||||||
}else if(key == P_FrontCrossData){
|
}else if(key == P_FrontCrossData){
|
||||||
|
@ -79,7 +79,7 @@ namespace cocostudio
|
||||||
|
|
||||||
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
std::string backgroundValue = this->getResourcePath(pCocoLoader, &stChildArray[i], imageFileNameType);
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
checkBox->loadTextureFrontCross(backgroundValue, imageFileNameType);
|
checkBox->loadTextureFrontCross(backgroundValue, imageFileNameType);
|
||||||
}else if(key == P_BackGroundBoxDisabledData){
|
}else if(key == P_BackGroundBoxDisabledData){
|
||||||
|
@ -88,7 +88,7 @@ namespace cocostudio
|
||||||
|
|
||||||
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
std::string backgroundValue = this->getResourcePath(pCocoLoader, &stChildArray[i], imageFileNameType);
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
checkBox->loadTextureBackGroundDisabled(backgroundValue, imageFileNameType);
|
checkBox->loadTextureBackGroundDisabled(backgroundValue, imageFileNameType);
|
||||||
}else if (key == P_FrontCrossDisabledData){
|
}else if (key == P_FrontCrossDisabledData){
|
||||||
|
@ -97,7 +97,7 @@ namespace cocostudio
|
||||||
|
|
||||||
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
std::string backgroundValue = this->getResourcePath(pCocoLoader, &stChildArray[i], imageFileNameType);
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
checkBox->loadTextureFrontCrossDisabled(backgroundValue, imageFileNameType);
|
checkBox->loadTextureFrontCrossDisabled(backgroundValue, imageFileNameType);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace cocostudio
|
||||||
static void purge();
|
static void purge();
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
||||||
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* pCocoLoader, stExpCocoNode* pCocoNode);
|
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,18 +42,18 @@ namespace cocostudio
|
||||||
return instanceImageViewReader;
|
return instanceImageViewReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImageViewReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode)
|
void ImageViewReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
|
||||||
{
|
{
|
||||||
WidgetReader::setPropsFromBinary(widget, pCocoLoader, pCocoNode);
|
WidgetReader::setPropsFromBinary(widget, cocoLoader, cocoNode);
|
||||||
|
|
||||||
ImageView* imageView = static_cast<ImageView*>(widget);
|
ImageView* imageView = static_cast<ImageView*>(widget);
|
||||||
this->beginSetBasicProperties(widget);
|
this->beginSetBasicProperties(widget);
|
||||||
float capsx = 0.0f, capsy = 0.0, capsWidth = 0.0, capsHeight = 0.0f;
|
float capsx = 0.0f, capsy = 0.0, capsWidth = 0.0, capsHeight = 0.0f;
|
||||||
|
|
||||||
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
|
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
|
||||||
|
|
||||||
for (int i = 0; i < pCocoNode->GetChildNum(); ++i) {
|
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
|
||||||
std::string key = stChildArray[i].GetName(pCocoLoader);
|
std::string key = stChildArray[i].GetName(cocoLoader);
|
||||||
std::string value = stChildArray[i].GetValue();
|
std::string value = stChildArray[i].GetValue();
|
||||||
|
|
||||||
//read all basic properties of widget
|
//read all basic properties of widget
|
||||||
|
@ -70,7 +70,7 @@ namespace cocostudio
|
||||||
|
|
||||||
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
std::string backgroundValue = this->getResourcePath(pCocoLoader, &stChildArray[i], imageFileNameType);
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
imageView->loadTexture(backgroundValue, imageFileNameType);
|
imageView->loadTexture(backgroundValue, imageFileNameType);
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace cocostudio
|
||||||
static void purge();
|
static void purge();
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
||||||
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* pCocoLoader, stExpCocoNode* pCocoNode);
|
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,14 +54,14 @@ namespace cocostudio
|
||||||
return instanceLayoutReader;
|
return instanceLayoutReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayoutReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode)
|
void LayoutReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
|
||||||
{
|
{
|
||||||
WidgetReader::setPropsFromBinary(widget, pCocoLoader, pCocoNode);
|
WidgetReader::setPropsFromBinary(widget, cocoLoader, cocoNode);
|
||||||
|
|
||||||
Layout* panel = static_cast<Layout*>(widget);
|
Layout* panel = static_cast<Layout*>(widget);
|
||||||
|
|
||||||
|
|
||||||
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
|
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
|
||||||
this->beginSetBasicProperties(widget);
|
this->beginSetBasicProperties(widget);
|
||||||
|
|
||||||
int cr=0, cg = 0, cb = 0;
|
int cr=0, cg = 0, cb = 0;
|
||||||
|
@ -72,8 +72,8 @@ namespace cocostudio
|
||||||
Layout::Type layoutType;
|
Layout::Type layoutType;
|
||||||
int bgColorOpacity = panel->getBackGroundColorOpacity();
|
int bgColorOpacity = panel->getBackGroundColorOpacity();
|
||||||
|
|
||||||
for (int i = 0; i < pCocoNode->GetChildNum(); ++i) {
|
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
|
||||||
std::string key = stChildArray[i].GetName(pCocoLoader);
|
std::string key = stChildArray[i].GetName(cocoLoader);
|
||||||
std::string value = stChildArray[i].GetValue();
|
std::string value = stChildArray[i].GetValue();
|
||||||
|
|
||||||
//read all basic properties of widget
|
//read all basic properties of widget
|
||||||
|
@ -126,7 +126,7 @@ namespace cocostudio
|
||||||
|
|
||||||
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
std::string backgroundValue = this->getResourcePath(pCocoLoader, &stChildArray[i], imageFileNameType);
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
panel->setBackGroundImage(backgroundValue, imageFileNameType);
|
panel->setBackGroundImage(backgroundValue, imageFileNameType);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace cocostudio
|
||||||
static void purge();
|
static void purge();
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
||||||
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* pCocoLoader, stExpCocoNode* pCocoNode) ;
|
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,16 +35,16 @@ namespace cocostudio
|
||||||
return instanceListViewReader;
|
return instanceListViewReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListViewReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode)
|
void ListViewReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode* cocoNode)
|
||||||
{
|
{
|
||||||
ScrollViewReader::setPropsFromBinary(widget, pCocoLoader, pCocoNode);
|
ScrollViewReader::setPropsFromBinary(widget, cocoLoader, cocoNode);
|
||||||
|
|
||||||
ListView* listView = static_cast<ListView*>(widget);
|
ListView* listView = static_cast<ListView*>(widget);
|
||||||
|
|
||||||
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
|
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
|
||||||
|
|
||||||
for (int i = 0; i < pCocoNode->GetChildNum(); ++i) {
|
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
|
||||||
std::string key = stChildArray[i].GetName(pCocoLoader);
|
std::string key = stChildArray[i].GetName(cocoLoader);
|
||||||
std::string value = stChildArray[i].GetValue();
|
std::string value = stChildArray[i].GetValue();
|
||||||
|
|
||||||
if (key == P_Direction) {
|
if (key == P_Direction) {
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace cocostudio
|
||||||
static void purge();
|
static void purge();
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
||||||
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* pCocoLoader, stExpCocoNode* pCocoNode) ;
|
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,19 +42,19 @@ namespace cocostudio
|
||||||
return instanceLoadingBar;
|
return instanceLoadingBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadingBarReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode)
|
void LoadingBarReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
|
||||||
{
|
{
|
||||||
WidgetReader::setPropsFromBinary(widget, pCocoLoader, pCocoNode);
|
WidgetReader::setPropsFromBinary(widget, cocoLoader, cocoNode);
|
||||||
|
|
||||||
LoadingBar* loadingBar = static_cast<LoadingBar*>(widget);
|
LoadingBar* loadingBar = static_cast<LoadingBar*>(widget);
|
||||||
this->beginSetBasicProperties(widget);
|
this->beginSetBasicProperties(widget);
|
||||||
float capsx = 0.0f, capsy = 0.0, capsWidth = 0.0, capsHeight = 0.0f;
|
float capsx = 0.0f, capsy = 0.0, capsWidth = 0.0, capsHeight = 0.0f;
|
||||||
int percent = loadingBar->getPercent();
|
int percent = loadingBar->getPercent();
|
||||||
|
|
||||||
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
|
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
|
||||||
|
|
||||||
for (int i = 0; i < pCocoNode->GetChildNum(); ++i) {
|
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
|
||||||
std::string key = stChildArray[i].GetName(pCocoLoader);
|
std::string key = stChildArray[i].GetName(cocoLoader);
|
||||||
std::string value = stChildArray[i].GetValue();
|
std::string value = stChildArray[i].GetValue();
|
||||||
|
|
||||||
//read all basic properties of widget
|
//read all basic properties of widget
|
||||||
|
@ -72,7 +72,7 @@ namespace cocostudio
|
||||||
|
|
||||||
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
std::string backgroundValue = this->getResourcePath(pCocoLoader, &stChildArray[i], imageFileNameType);
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
loadingBar->loadTexture(backgroundValue, imageFileNameType);
|
loadingBar->loadTexture(backgroundValue, imageFileNameType);
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace cocostudio
|
||||||
static void purge();
|
static void purge();
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
||||||
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* pCocoLoader, stExpCocoNode* pCocoNode) ;
|
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,9 +33,9 @@ namespace cocostudio
|
||||||
return instancePageViewReader;
|
return instancePageViewReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PageViewReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode)
|
void PageViewReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
|
||||||
{
|
{
|
||||||
LayoutReader::setPropsFromBinary(widget, pCocoLoader, pCocoNode);
|
LayoutReader::setPropsFromBinary(widget, cocoLoader, cocoNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PageViewReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
void PageViewReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace cocostudio
|
||||||
static void purge();
|
static void purge();
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
||||||
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* pCocoLoader, stExpCocoNode* pCocoNode) ;
|
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* cocoNode) ;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,18 +37,18 @@ namespace cocostudio
|
||||||
return instanceScrollViewReader;
|
return instanceScrollViewReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScrollViewReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode)
|
void ScrollViewReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode* cocoNode)
|
||||||
{
|
{
|
||||||
//TODO::need to refactor...
|
//TODO::need to refactor...
|
||||||
LayoutReader::setPropsFromBinary(widget, pCocoLoader, pCocoNode);
|
LayoutReader::setPropsFromBinary(widget, cocoLoader, cocoNode);
|
||||||
|
|
||||||
ScrollView* scrollView = static_cast<ScrollView*>(widget);
|
ScrollView* scrollView = static_cast<ScrollView*>(widget);
|
||||||
|
|
||||||
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
|
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
|
||||||
float innerWidth;
|
float innerWidth;
|
||||||
float innerHeight;
|
float innerHeight;
|
||||||
for (int i = 0; i < pCocoNode->GetChildNum(); ++i) {
|
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
|
||||||
std::string key = stChildArray[i].GetName(pCocoLoader);
|
std::string key = stChildArray[i].GetName(cocoLoader);
|
||||||
std::string value = stChildArray[i].GetValue();
|
std::string value = stChildArray[i].GetValue();
|
||||||
if (key == P_InnerWidth) {
|
if (key == P_InnerWidth) {
|
||||||
innerWidth = valueToFloat(value);
|
innerWidth = valueToFloat(value);
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace cocostudio
|
||||||
static void purge();
|
static void purge();
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
||||||
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* pCocoLoader, stExpCocoNode* pCocoNode) ;
|
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace cocostudio
|
||||||
return instanceSliderReader;
|
return instanceSliderReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SliderReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode)
|
void SliderReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode* cocoNode)
|
||||||
{
|
{
|
||||||
this->beginSetBasicProperties(widget);
|
this->beginSetBasicProperties(widget);
|
||||||
|
|
||||||
|
@ -51,10 +51,10 @@ namespace cocostudio
|
||||||
|
|
||||||
float barLength = 0.0f;
|
float barLength = 0.0f;
|
||||||
int percent = slider->getPercent();
|
int percent = slider->getPercent();
|
||||||
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
|
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
|
||||||
|
|
||||||
for (int i = 0; i < pCocoNode->GetChildNum(); ++i) {
|
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
|
||||||
std::string key = stChildArray[i].GetName(pCocoLoader);
|
std::string key = stChildArray[i].GetName(cocoLoader);
|
||||||
std::string value = stChildArray[i].GetValue();
|
std::string value = stChildArray[i].GetValue();
|
||||||
|
|
||||||
//read all basic properties of widget
|
//read all basic properties of widget
|
||||||
|
@ -74,7 +74,7 @@ namespace cocostudio
|
||||||
|
|
||||||
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
std::string backgroundValue = this->getResourcePath(pCocoLoader, &stChildArray[i], imageFileNameType);
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
slider->loadBarTexture(backgroundValue, imageFileNameType);
|
slider->loadBarTexture(backgroundValue, imageFileNameType);
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ namespace cocostudio
|
||||||
|
|
||||||
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
std::string backgroundValue = this->getResourcePath(pCocoLoader, &stChildArray[i], imageFileNameType);
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
slider->loadSlidBallTextureNormal(backgroundValue, imageFileNameType);
|
slider->loadSlidBallTextureNormal(backgroundValue, imageFileNameType);
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ namespace cocostudio
|
||||||
|
|
||||||
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
std::string backgroundValue = this->getResourcePath(pCocoLoader, &stChildArray[i], imageFileNameType);
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
slider->loadSlidBallTexturePressed(backgroundValue, imageFileNameType);
|
slider->loadSlidBallTexturePressed(backgroundValue, imageFileNameType);
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ namespace cocostudio
|
||||||
|
|
||||||
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
std::string backgroundValue = this->getResourcePath(pCocoLoader, &stChildArray[i], imageFileNameType);
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
slider->loadSlidBallTextureDisabled(backgroundValue, imageFileNameType);
|
slider->loadSlidBallTextureDisabled(backgroundValue, imageFileNameType);
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ namespace cocostudio
|
||||||
|
|
||||||
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
std::string backgroundValue = this->getResourcePath(pCocoLoader, &stChildArray[i], imageFileNameType);
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
slider->loadProgressBarTexture(backgroundValue, imageFileNameType);
|
slider->loadProgressBarTexture(backgroundValue, imageFileNameType);
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace cocostudio
|
||||||
static void purge();
|
static void purge();
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
||||||
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* pCocoLoader, stExpCocoNode* pCocoNode) ;
|
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,22 +41,22 @@ namespace cocostudio
|
||||||
return instanceTextAtalsReader;
|
return instanceTextAtalsReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextAtlasReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode)
|
void TextAtlasReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
|
||||||
{
|
{
|
||||||
this->beginSetBasicProperties(widget);
|
this->beginSetBasicProperties(widget);
|
||||||
|
|
||||||
TextAtlas* labelAtlas = static_cast<TextAtlas*>(widget);
|
TextAtlas* labelAtlas = static_cast<TextAtlas*>(widget);
|
||||||
|
|
||||||
|
|
||||||
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
|
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
|
||||||
Widget::TextureResType type;
|
Widget::TextureResType type;
|
||||||
std::string charMapFileName;
|
std::string charMapFileName;
|
||||||
std::string stringValue;
|
std::string stringValue;
|
||||||
std::string startCharMap;
|
std::string startCharMap;
|
||||||
float itemWidth;
|
float itemWidth;
|
||||||
float itemHeight;
|
float itemHeight;
|
||||||
for (int i = 0; i < pCocoNode->GetChildNum(); ++i) {
|
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
|
||||||
std::string key = stChildArray[i].GetName(pCocoLoader);
|
std::string key = stChildArray[i].GetName(cocoLoader);
|
||||||
std::string value = stChildArray[i].GetValue();
|
std::string value = stChildArray[i].GetValue();
|
||||||
|
|
||||||
//read all basic properties of widget
|
//read all basic properties of widget
|
||||||
|
@ -73,7 +73,7 @@ namespace cocostudio
|
||||||
|
|
||||||
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
std::string backgroundValue = this->getResourcePath(pCocoLoader, &stChildArray[i], imageFileNameType);
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
charMapFileName = backgroundValue;
|
charMapFileName = backgroundValue;
|
||||||
type = imageFileNameType;
|
type = imageFileNameType;
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace cocostudio
|
||||||
static TextAtlasReader* getInstance();
|
static TextAtlasReader* getInstance();
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
||||||
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* pCocoLoader, stExpCocoNode* pCocoNode) ;
|
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,17 +35,17 @@ namespace cocostudio
|
||||||
return instanceTextBMFontReader;
|
return instanceTextBMFontReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextBMFontReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode)
|
void TextBMFontReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
|
||||||
{
|
{
|
||||||
this->beginSetBasicProperties(widget);
|
this->beginSetBasicProperties(widget);
|
||||||
|
|
||||||
TextBMFont* labelBMFont = static_cast<TextBMFont*>(widget);
|
TextBMFont* labelBMFont = static_cast<TextBMFont*>(widget);
|
||||||
|
|
||||||
|
|
||||||
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
|
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
|
||||||
|
|
||||||
for (int i = 0; i < pCocoNode->GetChildNum(); ++i) {
|
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
|
||||||
std::string key = stChildArray[i].GetName(pCocoLoader);
|
std::string key = stChildArray[i].GetName(cocoLoader);
|
||||||
std::string value = stChildArray[i].GetValue();
|
std::string value = stChildArray[i].GetValue();
|
||||||
//read all basic properties of widget
|
//read all basic properties of widget
|
||||||
CC_BASIC_PROPERTY_BINARY_READER
|
CC_BASIC_PROPERTY_BINARY_READER
|
||||||
|
@ -58,7 +58,7 @@ namespace cocostudio
|
||||||
|
|
||||||
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
std::string backgroundValue = this->getResourcePath(pCocoLoader, &stChildArray[i], imageFileNameType);
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
if (imageFileNameType == (Widget::TextureResType)0) {
|
if (imageFileNameType == (Widget::TextureResType)0) {
|
||||||
labelBMFont->setFntFile(backgroundValue);
|
labelBMFont->setFntFile(backgroundValue);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace cocostudio
|
||||||
static void purge();
|
static void purge();
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
||||||
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* pCocoLoader, stExpCocoNode* pCocoNode) ;
|
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,16 +43,16 @@ namespace cocostudio
|
||||||
return instanceTextFieldReader;
|
return instanceTextFieldReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextFieldReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode)
|
void TextFieldReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode* cocoNode)
|
||||||
{
|
{
|
||||||
this->beginSetBasicProperties(widget);
|
this->beginSetBasicProperties(widget);
|
||||||
|
|
||||||
TextField* textField = static_cast<TextField*>(widget);
|
TextField* textField = static_cast<TextField*>(widget);
|
||||||
|
|
||||||
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
|
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
|
||||||
|
|
||||||
for (int i = 0; i < pCocoNode->GetChildNum(); ++i) {
|
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
|
||||||
std::string key = stChildArray[i].GetName(pCocoLoader);
|
std::string key = stChildArray[i].GetName(cocoLoader);
|
||||||
std::string value = stChildArray[i].GetValue();
|
std::string value = stChildArray[i].GetValue();
|
||||||
|
|
||||||
//read all basic properties of widget
|
//read all basic properties of widget
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace cocostudio
|
||||||
static void purge();
|
static void purge();
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
||||||
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* pCocoLoader, stExpCocoNode* pCocoNode) ;
|
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,17 +41,17 @@ namespace cocostudio
|
||||||
return instanceTextReader;
|
return instanceTextReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode)
|
void TextReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
|
||||||
{
|
{
|
||||||
this->beginSetBasicProperties(widget);
|
this->beginSetBasicProperties(widget);
|
||||||
|
|
||||||
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
|
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
|
||||||
|
|
||||||
Text* label = static_cast<Text*>(widget);
|
Text* label = static_cast<Text*>(widget);
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < pCocoNode->GetChildNum(); ++i) {
|
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
|
||||||
std::string key = stChildArray[i].GetName(pCocoLoader);
|
std::string key = stChildArray[i].GetName(cocoLoader);
|
||||||
std::string value = stChildArray[i].GetValue();
|
std::string value = stChildArray[i].GetValue();
|
||||||
//read all basic properties of widget
|
//read all basic properties of widget
|
||||||
CC_BASIC_PROPERTY_BINARY_READER
|
CC_BASIC_PROPERTY_BINARY_READER
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace cocostudio
|
||||||
static void purge();
|
static void purge();
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
||||||
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* pCocoLoader, stExpCocoNode* pCocoNode);
|
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode);
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -291,9 +291,9 @@ namespace cocostudio
|
||||||
return imageFileName_tp;
|
return imageFileName_tp;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string WidgetReader::getResourcePath(CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode, cocos2d::ui::Widget::TextureResType texType)
|
std::string WidgetReader::getResourcePath(CocoLoader *cocoLoader, stExpCocoNode *cocoNode, cocos2d::ui::Widget::TextureResType texType)
|
||||||
{
|
{
|
||||||
stExpCocoNode *backGroundChildren = pCocoNode->GetChildArray();
|
stExpCocoNode *backGroundChildren = cocoNode->GetChildArray();
|
||||||
std::string backgroundValue = backGroundChildren[0].GetValue();
|
std::string backgroundValue = backGroundChildren[0].GetValue();
|
||||||
|
|
||||||
if (backgroundValue.size() < 3) {
|
if (backgroundValue.size() < 3) {
|
||||||
|
@ -342,14 +342,14 @@ namespace cocostudio
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WidgetReader::setPropsFromBinary(cocos2d::ui::Widget *widget, cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCocoNode *pCocoNode)
|
void WidgetReader::setPropsFromBinary(cocos2d::ui::Widget *widget, cocostudio::CocoLoader *cocoLoader, cocostudio::stExpCocoNode *cocoNode)
|
||||||
{
|
{
|
||||||
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
|
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
|
||||||
|
|
||||||
this->beginSetBasicProperties(widget);
|
this->beginSetBasicProperties(widget);
|
||||||
|
|
||||||
for (int i = 0; i < pCocoNode->GetChildNum(); ++i) {
|
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
|
||||||
std::string key = stChildArray[i].GetName(pCocoLoader);
|
std::string key = stChildArray[i].GetName(cocoLoader);
|
||||||
std::string value = stChildArray[i].GetValue();
|
std::string value = stChildArray[i].GetValue();
|
||||||
|
|
||||||
CC_BASIC_PROPERTY_BINARY_READER
|
CC_BASIC_PROPERTY_BINARY_READER
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace cocostudio
|
||||||
virtual void setColorPropsFromJsonDictionary(cocos2d::ui::Widget* widget,
|
virtual void setColorPropsFromJsonDictionary(cocos2d::ui::Widget* widget,
|
||||||
const rapidjson::Value& options);
|
const rapidjson::Value& options);
|
||||||
|
|
||||||
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* pCocoLoader, stExpCocoNode* pCocoNode);
|
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode);
|
||||||
protected:
|
protected:
|
||||||
std::string getResourcePath(const rapidjson::Value& dict,
|
std::string getResourcePath(const rapidjson::Value& dict,
|
||||||
const std::string& key,
|
const std::string& key,
|
||||||
|
@ -61,7 +61,7 @@ namespace cocostudio
|
||||||
void setAnchorPointForWidget(cocos2d::ui::Widget* widget, const rapidjson::Value&options);
|
void setAnchorPointForWidget(cocos2d::ui::Widget* widget, const rapidjson::Value&options);
|
||||||
|
|
||||||
|
|
||||||
std::string getResourcePath(CocoLoader* pCocoLoader,
|
std::string getResourcePath(CocoLoader* cocoLoader,
|
||||||
stExpCocoNode* pCocoNode,
|
stExpCocoNode* pCocoNode,
|
||||||
cocos2d::ui::Widget::TextureResType texType);
|
cocos2d::ui::Widget::TextureResType texType);
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ namespace cocostudio
|
||||||
ui::Margin mg; \
|
ui::Margin mg; \
|
||||||
int paramType = -1; \
|
int paramType = -1; \
|
||||||
for (int j = 0; j < stChildArray[i].GetChildNum(); ++j) { \
|
for (int j = 0; j < stChildArray[i].GetChildNum(); ++j) { \
|
||||||
std::string innerKey = layoutCocosNode[j].GetName(pCocoLoader); \
|
std::string innerKey = layoutCocosNode[j].GetName(cocoLoader); \
|
||||||
std::string innerValue = layoutCocosNode[j].GetValue(); \
|
std::string innerValue = layoutCocosNode[j].GetValue(); \
|
||||||
if (innerKey == P_Type) { \
|
if (innerKey == P_Type) { \
|
||||||
paramType = valueToInt(innerValue); \
|
paramType = valueToInt(innerValue); \
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace cocostudio
|
||||||
public:
|
public:
|
||||||
virtual ~WidgetReaderProtocol() {};
|
virtual ~WidgetReaderProtocol() {};
|
||||||
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options) = 0;
|
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options) = 0;
|
||||||
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* pCocoLoader, stExpCocoNode* pCocoNode) = 0;
|
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue