remove Hungry style

This commit is contained in:
andyque 2014-06-23 10:02:09 +08:00
parent 5624da5448
commit 8a463e7964
41 changed files with 221 additions and 221 deletions

View File

@ -74,7 +74,7 @@ void ActionManagerEx::initWithDictionary(const char* jsonName,const rapidjson::V
void ActionManagerEx::initWithBinary(const char* file,
cocos2d::Ref *root,
CocoLoader* pCocoLoader,
CocoLoader* cocoLoader,
stExpCocoNode* pCocoNode)
{
std::string path = file;
@ -86,7 +86,7 @@ void ActionManagerEx::initWithDictionary(const char* jsonName,const rapidjson::V
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
stExpCocoNode *actionNode = NULL;
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") {
actionNode = &stChildArray[i];
break;
@ -99,7 +99,7 @@ void ActionManagerEx::initWithDictionary(const char* jsonName,const rapidjson::V
ActionObject* action = new ActionObject();
action->autorelease();
action->initWithBinary(pCocoLoader, actionNode->GetChildArray(), root);
action->initWithBinary(cocoLoader, actionNode->GetChildArray(), root);
actionList.pushBack(action);
}

View File

@ -99,7 +99,7 @@ public:
/*init properties with json dictionay*/
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.

View File

@ -187,18 +187,18 @@ void ActionNode::initWithDictionary(const rapidjson::Value& dic, Ref* root)
return atof(value.c_str());
}
void ActionNode::initWithBinary(CocoLoader *pCocoLoader,
stExpCocoNode *pCocoNode,
void ActionNode::initWithBinary(CocoLoader *cocoLoader,
stExpCocoNode *cocoNode,
cocos2d::Ref *root)
{
stExpCocoNode *stChildNode = pCocoNode;
stExpCocoNode *stChildNode = cocoNode;
int actionNodeCount = stChildNode->GetChildNum();
stChildNode = stChildNode[0].GetChildArray();
stExpCocoNode *frameListNode = NULL;
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();
if (key == "ActionTag") {
setActionTag(valueToInt(value));
@ -227,7 +227,7 @@ void ActionNode::initWithDictionary(const rapidjson::Value& dic, Ref* root)
int framesCount = stFrameChildNode[i].GetChildNum();
stExpCocoNode *innerFrameNode = stFrameChildNode[i].GetChildArray();
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();
if (key == "frameid") {
@ -239,7 +239,7 @@ void ActionNode::initWithDictionary(const rapidjson::Value& dic, Ref* root)
int tweenParameterCount = innerFrameNode[j].GetChildNum();
stExpCocoNode *tweenParameterArray = innerFrameNode[j].GetChildArray();
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();
frameTweenParameter.push_back(valueToFloat(t_value));
}

View File

@ -151,7 +151,7 @@ public:
/*init properties with a json dictionary*/
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.

View File

@ -128,15 +128,15 @@ void ActionObject::initWithDictionary(const rapidjson::Value& dic, Ref* root)
_fTotalTime = maxLength*_fUnitTime;
}
void ActionObject::initWithBinary(CocoLoader *pCocoLoader,
stExpCocoNode *pCocoNode,
void ActionObject::initWithBinary(CocoLoader *cocoLoader,
stExpCocoNode *cocoNode,
cocos2d::Ref *root)
{
stExpCocoNode *stChildNode = pCocoNode->GetChildArray();
stExpCocoNode *stChildNode = cocoNode->GetChildArray();
stExpCocoNode *actionNodeList = NULL;
int count = pCocoNode->GetChildNum();
int count = cocoNode->GetChildNum();
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();
if (key == "name") {
setName(value.c_str());
@ -158,7 +158,7 @@ void ActionObject::initWithBinary(CocoLoader *pCocoLoader,
ActionNode* actionNode = new ActionNode();
actionNode->autorelease();
actionNode->initWithBinary(pCocoLoader, &actionNodeArray[i] , root);
actionNode->initWithBinary(cocoLoader, &actionNodeArray[i] , root);
actionNode->setUnitTime(getUnitTime());

View File

@ -164,7 +164,7 @@ public:
/*init properties with a json dictionary*/
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*/

View File

@ -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->init();
stExpCocoNode *pAramtureDataArray = pCocoNode->GetChildArray();
stExpCocoNode *pAramtureDataArray = cocoNode->GetChildArray();
const char *name = pAramtureDataArray[2].GetValue(); //DICTOOL->getStringValue_json(json, A_NAME);
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];
child = &pBoneChildren[i];
BoneData *boneData = decodeBone(pCocoLoader, child, dataInfo);
BoneData *boneData = decodeBone(cocoLoader, child, dataInfo);
armatureData->addBoneData(boneData);
boneData->release();
}
@ -1894,22 +1894,22 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
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->init();
decodeNode(boneData, pCocoLoader, pCocoNode, dataInfo);
decodeNode(boneData, cocoLoader, cocoNode, dataInfo);
int length = pCocoNode->GetChildNum();
stExpCocoNode *pBoneChildren = pCocoNode->GetChildArray();
int length = cocoNode->GetChildNum();
stExpCocoNode *pBoneChildren = cocoNode->GetChildArray();
stExpCocoNode* child;
const char *str = NULL;
std::string key;
for (int i = 0; i < length; ++i)
{
child = &pBoneChildren[i];
key = child->GetName(pCocoLoader);
key = child->GetName(cocoLoader);
str = child->GetValue();
if (key.compare(A_NAME) == 0)
{
@ -1933,7 +1933,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
stExpCocoNode *pDisplayData = child->GetChildArray();
for (int ii = 0; ii < count; ++ii)
{
DisplayData *displayData = decodeBoneDisplay(pCocoLoader, &pDisplayData[ii], dataInfo);
DisplayData *displayData = decodeBoneDisplay(cocoLoader, &pDisplayData[ii], dataInfo);
if(displayData == NULL)
continue;
boneData->addDisplayData(displayData);
@ -1945,13 +1945,13 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
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];
const char *str = NULL;
std::string key = child->GetName(pCocoLoader);
std::string key = child->GetName(cocoLoader);
str = child->GetValue();
DisplayData *displayData = NULL;
if (key.compare(A_DISPLAY_TYPE) == 0)
@ -1982,7 +1982,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
stExpCocoNode *SkinDataValue = pSkinData->GetChildArray();
for (int i = 0; i < length; ++i)
{
key = SkinDataValue[i].GetName(pCocoLoader);
key = SkinDataValue[i].GetName(cocoLoader);
str = SkinDataValue[i].GetValue();
if (key.compare(A_X) == 0)
{
@ -2021,7 +2021,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
{
displayData = new ArmatureDisplayData();
const char *name = pCocoNode[0].GetValue();
const char *name = cocoNode[0].GetValue();
if(name != NULL)
{
((ArmatureDisplayData *)displayData)->displayName = name;
@ -2031,11 +2031,11 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
case CS_DISPLAY_PARTICLE:
{
displayData = new ParticleDisplayData();
length = pCocoNode->GetChildNum();
stExpCocoNode *pDisplayData = pCocoNode->GetChildArray();
length = cocoNode->GetChildNum();
stExpCocoNode *pDisplayData = cocoNode->GetChildArray();
for (int i = 0; i < length; ++i)
{
key = pDisplayData[i].GetName(pCocoLoader);
key = pDisplayData[i].GetName(cocoLoader);
str = pDisplayData[i].GetValue();
if (key.compare(A_PLIST) == 0)
{
@ -2065,12 +2065,12 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
return displayData;
}
AnimationData* DataReaderHelper::decodeAnimation(CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo)
AnimationData* DataReaderHelper::decodeAnimation(CocoLoader *cocoLoader, stExpCocoNode *cocoNode, DataInfo *dataInfo)
{
AnimationData *aniData = new AnimationData();
int length = pCocoNode->GetChildNum();
stExpCocoNode *pAnimationData = pCocoNode->GetChildArray();
int length = cocoNode->GetChildNum();
stExpCocoNode *pAnimationData = cocoNode->GetChildArray();
const char *str = NULL;
std::string key;
stExpCocoNode* child;
@ -2078,7 +2078,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
for (int i = 0; i < length; ++i)
{
child = &pAnimationData[i];
key = child->GetName(pCocoLoader);
key = child->GetName(cocoLoader);
str = child->GetValue();
if (key.compare(A_NAME) == 0)
{
@ -2093,7 +2093,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
stExpCocoNode* movArray = child->GetChildArray();
for( int movnum =0; movnum <movcount; movnum++)
{
movementData = decodeMovement(pCocoLoader, &movArray[movnum], dataInfo);
movementData = decodeMovement(cocoLoader, &movArray[movnum], dataInfo);
aniData->addMovement(movementData);
movementData->release();
}
@ -2102,13 +2102,13 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
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->scale = 1.0f;
int length = pCocoNode->GetChildNum();
stExpCocoNode *pMoveDataArray = pCocoNode->GetChildArray();
int length = cocoNode->GetChildNum();
stExpCocoNode *pMoveDataArray = cocoNode->GetChildArray();
const char *str = NULL;
std::string key;
@ -2116,7 +2116,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
for (int i = 0; i < length; ++i)
{
child = &pMoveDataArray[i];
key = child->GetName(pCocoLoader);
key = child->GetName(cocoLoader);
str = child->GetValue();
if (key.compare(A_NAME) == 0)
{
@ -2183,7 +2183,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
MovementBoneData *movementBoneData;
for (int ii = 0; ii < count; ++ii)
{
movementBoneData = decodeMovementBone(pCocoLoader, &pMoveBoneData[ii],dataInfo);
movementBoneData = decodeMovementBone(cocoLoader, &pMoveBoneData[ii],dataInfo);
movementData->addMovementBoneData(movementBoneData);
movementBoneData->release();
}
@ -2192,19 +2192,19 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
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->init();
int length = pCocoNode->GetChildNum();
stExpCocoNode *pMovementBoneDataArray = pCocoNode->GetChildArray();
int length = cocoNode->GetChildNum();
stExpCocoNode *pMovementBoneDataArray = cocoNode->GetChildArray();
stExpCocoNode* movebonechild;
const char *str = NULL;
for (int i = 0; i < length; ++i)
{
movebonechild = &pMovementBoneDataArray[i];
std::string key = movebonechild->GetName(pCocoLoader);
std::string key = movebonechild->GetName(cocoLoader);
str = movebonechild->GetValue();
if (key.compare(A_NAME) == 0)
{
@ -2226,7 +2226,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
stExpCocoNode *pFrameDataArray = movebonechild->GetChildArray();
for (int ii = 0; ii < count; ++ii)
{
FrameData *frameData = decodeFrame(pCocoLoader, &pFrameDataArray[ii], dataInfo);
FrameData *frameData = decodeFrame(cocoLoader, &pFrameDataArray[ii], dataInfo);
movementBoneData->addFrameData(frameData);
frameData->release();
@ -2286,18 +2286,18 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
return movementBoneData;
}
FrameData* DataReaderHelper::decodeFrame(CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo)
FrameData* DataReaderHelper::decodeFrame(CocoLoader *cocoLoader, stExpCocoNode *cocoNode, DataInfo *dataInfo)
{
FrameData *frameData = new FrameData();
decodeNode(frameData, pCocoLoader, pCocoNode, dataInfo);
decodeNode(frameData, cocoLoader, cocoNode, dataInfo);
int length = pCocoNode->GetChildNum();
stExpCocoNode *pFrameDataArray = pCocoNode->GetChildArray();
int length = cocoNode->GetChildNum();
stExpCocoNode *pFrameDataArray = cocoNode->GetChildArray();
const char *str = NULL;
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();
if (key.compare(A_TWEEN_EASING) == 0)
{
@ -2390,33 +2390,33 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
return frameData;
}
TextureData* DataReaderHelper::decodeTexture(CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode)
TextureData* DataReaderHelper::decodeTexture(CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
{
TextureData *textureData = new TextureData();
textureData->init();
if(pCocoNode == NULL)
if(cocoNode == nullptr)
{
return textureData;
}
int length = pCocoNode->GetChildNum();
stExpCocoNode *pTextureDataArray = pCocoNode->GetChildArray();
const char *str = NULL;
int length = cocoNode->GetChildNum();
stExpCocoNode *pTextureDataArray = cocoNode->GetChildArray();
const char *str = nullptr;
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();
if (key.compare(A_NAME) == 0)
{
if(str != NULL)
if(str != nullptr)
{
textureData->name = str;
}
}
else if (key.compare(A_WIDTH) == 0)
{
if(str != NULL)
if(str != nullptr)
{
textureData->width = atof(str);
}
@ -2448,7 +2448,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
stExpCocoNode *pContourArray = pTextureDataArray[i].GetChildArray();
for (int ii = 0; ii < count; ++ii)
{
ContourData *contourData = decodeContour(pCocoLoader, &pContourArray[ii]);
ContourData *contourData = decodeContour(cocoLoader, &pContourArray[ii]);
textureData->contourDataList.pushBack(contourData);
contourData->release();
}
@ -2457,17 +2457,17 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
return textureData;
}
ContourData* DataReaderHelper::decodeContour(CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode)
ContourData* DataReaderHelper::decodeContour(CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
{
ContourData *contourData = new ContourData();
contourData->init();
int length = pCocoNode->GetChildNum();
stExpCocoNode *verTexPointArray = pCocoNode->GetChildArray();
const char *str = NULL;
int length = cocoNode->GetChildNum();
stExpCocoNode *verTexPointArray = cocoNode->GetChildArray();
const char *str = nullptr;
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();
if (key.compare(VERTEX_POINT) == 0)
{
@ -2487,10 +2487,10 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
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();
stExpCocoNode *NodeArray = pCocoNode->GetChildArray();
int length = cocoNode->GetChildNum();
stExpCocoNode *NodeArray = cocoNode->GetChildArray();
const char *str = NULL;
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)
{
child = &NodeArray[i];
std::string key = child->GetName(pCocoLoader);
std::string key = child->GetName(cocoLoader);
str = child->GetValue();
if (key.compare(A_X) == 0)
{
@ -2532,7 +2532,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
{
if (!isVersionL)
{
if (child->GetType(pCocoLoader) == rapidjson::kObjectType)
if (child->GetType(cocoLoader) == rapidjson::kObjectType)
{
if(child->GetChildNum() == 4)
{
@ -2559,7 +2559,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
if(colorcoount>0)
{
if (NodeArray[0].GetType(pCocoLoader) == rapidjson::kObjectType)
if (NodeArray[0].GetType(cocoLoader) == rapidjson::kObjectType)
{
if(NodeArray[0].GetChildNum() == 4)
{

View File

@ -180,19 +180,19 @@ public:
// for binary decode
public:
static void addDataFromBinaryCache(const char *fileContent, DataInfo *dataInfo = NULL);
static ArmatureData *decodeArmature(CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
static BoneData *decodeBone(CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
static DisplayData *decodeBoneDisplay(CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
static AnimationData *decodeAnimation(CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
static MovementData *decodeMovement(CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
static ArmatureData *decodeArmature(CocoLoader *cocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
static BoneData *decodeBone(CocoLoader *cocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
static DisplayData *decodeBoneDisplay(CocoLoader *cocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
static AnimationData *decodeAnimation(CocoLoader *cocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
static MovementData *decodeMovement(CocoLoader *cocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
static MovementBoneData *decodeMovementBone(CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
static FrameData *decodeFrame(CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
static MovementBoneData *decodeMovementBone(CocoLoader *cocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
static FrameData *decodeFrame(CocoLoader *cocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
static TextureData *decodeTexture(CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode);
static ContourData *decodeContour(CocoLoader *pCocoLoader, stExpCocoNode *pCocoNode);
static TextureData *decodeTexture(CocoLoader *cocoLoader, 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:
void loadData();

View File

@ -1218,17 +1218,17 @@ Widget* WidgetPropertiesReader0300::createWidget(const rapidjson::Value& data, c
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 fileDesignHeight;
Widget* widget = nullptr;
for (int i = 0; i < pCocoNode->GetChildNum(); ++i) {
std::string key = tpChildArray[i].GetName(pCocoLoader);
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
std::string key = tpChildArray[i].GetName(cocoLoader);
if (key == "textures") {
int texturesCount = tpChildArray[i].GetChildNum();
@ -1257,11 +1257,11 @@ Widget* WidgetPropertiesReader0300::createWidget(const rapidjson::Value& data, c
stExpCocoNode *widgetTreeNode = &tpChildArray[i];
rapidjson::Type tType = tpChildArray[i].GetType(pCocoLoader);
rapidjson::Type tType = tpChildArray[i].GetType(cocoLoader);
if (rapidjson::kObjectType == tType)
{
widget = widgetFromBinary(pCocoLoader, widgetTreeNode);
widget = widgetFromBinary(cocoLoader, widgetTreeNode);
}
if (widget->getContentSize().equals(Size::ZERO))
@ -1274,12 +1274,12 @@ Widget* WidgetPropertiesReader0300::createWidget(const rapidjson::Value& data, c
/* ********************** */
/* ********************** */
stExpCocoNode *optionChildNode = pCocoNode->GetChildArray();
for (int k = 0; k < pCocoNode->GetChildNum(); ++k) {
std::string key = optionChildNode[k].GetName(pCocoLoader);
stExpCocoNode *optionChildNode = cocoNode->GetChildArray();
for (int k = 0; k < cocoNode->GetChildNum(); ++k) {
std::string key = optionChildNode[k].GetName(cocoLoader);
if (key == "animation") {
Ref* rootWidget = (Ref*) widget;
ActionManagerEx::getInstance()->initWithBinary(fileName,rootWidget,pCocoLoader, &optionChildNode[k]);
ActionManagerEx::getInstance()->initWithBinary(fileName,rootWidget,cocoLoader, &optionChildNode[k]);
break;
}
}
@ -1287,17 +1287,17 @@ Widget* WidgetPropertiesReader0300::createWidget(const rapidjson::Value& data, c
return widget;
}
Widget* WidgetPropertiesReader0300::widgetFromBinary(CocoLoader* pCocoLoader, stExpCocoNode* pCocoNode)
Widget* WidgetPropertiesReader0300::widgetFromBinary(CocoLoader* cocoLoader, stExpCocoNode* cocoNode)
{
Widget* widget = nullptr;
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
stExpCocoNode *optionsNode = nullptr;
stExpCocoNode *childrenNode = nullptr;
int elementCount = pCocoNode->GetChildNum();
int elementCount = cocoNode->GetChildNum();
std::string classname;
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();
if (key == "classname" )
@ -1326,7 +1326,7 @@ Widget* WidgetPropertiesReader0300::widgetFromBinary(CocoLoader* pCocoLoader, s
if (reader)
{
// widget parse with widget reader
setPropsForAllWidgetFromBinary(reader, widget, pCocoLoader,optionsNode);
setPropsForAllWidgetFromBinary(reader, widget, cocoLoader,optionsNode);
}
else
{
@ -1336,13 +1336,13 @@ Widget* WidgetPropertiesReader0300::widgetFromBinary(CocoLoader* pCocoLoader, s
if (reader && widget) {
setPropsForAllWidgetFromBinary(reader, widget, pCocoLoader, optionsNode);
setPropsForAllWidgetFromBinary(reader, widget, cocoLoader, optionsNode);
// 2nd., custom widget parse with custom reader
//2nd. parse custom property
const char* customProperty = NULL;
stExpCocoNode *optionChildNode = optionsNode->GetChildArray();
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") {
customProperty = optionChildNode[k].GetValue();
break;
@ -1364,17 +1364,17 @@ Widget* WidgetPropertiesReader0300::widgetFromBinary(CocoLoader* pCocoLoader, s
//parse children
if (nullptr != childrenNode) {
rapidjson::Type tType22 = childrenNode->GetType(pCocoLoader);
rapidjson::Type tType22 = childrenNode->GetType(cocoLoader);
if (tType22 == rapidjson::kArrayType) {
int childrenCount = childrenNode->GetChildNum();
stExpCocoNode* innerChildArray = childrenNode->GetChildArray();
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) {
Widget *child = widgetFromBinary(pCocoLoader, &innerChildArray[i]);
Widget *child = widgetFromBinary(cocoLoader, &innerChildArray[i]);
if (child)
{
@ -1417,10 +1417,10 @@ Widget* WidgetPropertiesReader0300::widgetFromBinary(CocoLoader* pCocoLoader, s
void WidgetPropertiesReader0300::setPropsForAllWidgetFromBinary(WidgetReaderProtocol* reader,
cocos2d::ui::Widget* widget,
CocoLoader* pCocoLoader,
stExpCocoNode* pCocoNode)
CocoLoader* cocoLoader,
stExpCocoNode* cocoNode)
{
reader->setPropsFromBinary(widget, pCocoLoader, pCocoNode);
reader->setPropsFromBinary(widget, cocoLoader, cocoNode);
}

View File

@ -104,16 +104,16 @@ public:
const rapidjson::Value& customOptions) = 0;
//add binary parsing
virtual cocos2d::ui::Widget* createWidgetFromBinary(CocoLoader* pCocoLoader,stExpCocoNode* pCocoNode, const char* fileName)=0;
virtual cocos2d::ui::Widget* widgetFromBinary(CocoLoader* pCocoLoader, stExpCocoNode* pCocoNode) = 0;
virtual cocos2d::ui::Widget* createWidgetFromBinary(CocoLoader* cocoLoader,stExpCocoNode* pCocoNode, const char* fileName)=0;
virtual cocos2d::ui::Widget* widgetFromBinary(CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) = 0;
virtual void setPropsForAllWidgetFromBinary(WidgetReaderProtocol* reader,
cocos2d::ui::Widget* widget,
CocoLoader* pCocoLoader,
CocoLoader* cocoLoader,
stExpCocoNode* pCocoNode) = 0;
virtual void setPropsForAllCustomWidgetFromBinary(const std::string& classType,
cocos2d::ui::Widget* widget,
CocoLoader* pCocoLoader,
CocoLoader* cocoLoader,
stExpCocoNode* pCocoNode) = 0;
protected:
@ -143,21 +143,21 @@ public:
virtual cocos2d::ui::Widget* widgetFromJsonDictionary(const rapidjson::Value& dic);
//added for binary parsing
virtual cocos2d::ui::Widget* createWidgetFromBinary(CocoLoader* pCocoLoader,
virtual cocos2d::ui::Widget* createWidgetFromBinary(CocoLoader* cocoLoader,
stExpCocoNode* pCocoNode,
const char* fileName)override{return nullptr;}
virtual cocos2d::ui::Widget* widgetFromBinary(CocoLoader* pCocoLoader,
virtual cocos2d::ui::Widget* widgetFromBinary(CocoLoader* cocoLoader,
stExpCocoNode* pCocoNode){return nullptr;}
virtual void setPropsForAllWidgetFromBinary(WidgetReaderProtocol* reader,
cocos2d::ui::Widget* widget,
CocoLoader* pCocoLoader,
CocoLoader* cocoLoader,
stExpCocoNode* pCocoNode) {}
virtual void setPropsForAllCustomWidgetFromBinary(const std::string& classType,
cocos2d::ui::Widget* widget,
CocoLoader* pCocoLoader,
CocoLoader* cocoLoader,
stExpCocoNode* pCocoNode) {}
virtual void setPropsForWidgetFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options);
@ -196,21 +196,21 @@ public:
//add bin parse support
virtual cocos2d::ui::Widget* createWidgetFromBinary(CocoLoader* pCocoLoader,
virtual cocos2d::ui::Widget* createWidgetFromBinary(CocoLoader* cocoLoader,
stExpCocoNode* pCocoNode,
const char* fileName)override;
virtual cocos2d::ui::Widget* widgetFromBinary(CocoLoader* pCocoLoader,
virtual cocos2d::ui::Widget* widgetFromBinary(CocoLoader* cocoLoader,
stExpCocoNode* pCocoNode);
virtual void setPropsForAllWidgetFromBinary(WidgetReaderProtocol* reader,
cocos2d::ui::Widget* widget,
CocoLoader* pCocoLoader,
CocoLoader* cocoLoader,
stExpCocoNode* pCocoNode);
virtual void setPropsForAllCustomWidgetFromBinary(const std::string& classType,
cocos2d::ui::Widget* widget,
CocoLoader* pCocoLoader,
CocoLoader* cocoLoader,
stExpCocoNode* pCocoNode) {
//TODO: custom property
}

View File

@ -122,19 +122,19 @@ stExpCocoNode* stExpCocoNode::GetChildArray()
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;
if( -1 == m_AttribIndex )
{
if(m_ChildNum > 0)
{
m_ChildArray = m_ChildArray + (uint64_t)pCocoNodeAddr;
m_ChildArray = m_ChildArray + (uint64_t)cocoNodeAddr;
stExpCocoNode* tpChildArray = (stExpCocoNode*)m_ChildArray;
for(int i = 0 ; i < m_ChildNum ; i++)
{
tpChildArray[i].ReBuild(pCocoNodeAddr,pStringMemoryAddr);
tpChildArray[i].ReBuild(cocoNodeAddr,pStringMemoryAddr);
}
}
}

View File

@ -97,7 +97,7 @@ public:
stExpCocoNode* GetChildArray();
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);
};

View File

@ -57,21 +57,21 @@ namespace cocostudio
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);
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
this->beginSetBasicProperties(widget);
float capsx = 0.0f, capsy = 0.0, capsWidth = 0.0, capsHeight = 0.0f;
int cri = 255, cgi = 255, cbi = 255;
float scale9Width = 0.0f, scale9Height = 0.0f;
for (int i = 0; i < pCocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(pCocoLoader);
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(cocoLoader);
std::string value = stChildArray[i].GetValue();
// CCLOG("Button: key = %s, value = %d", key.c_str(), i);
@ -91,7 +91,7 @@ namespace cocostudio
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);
@ -103,7 +103,7 @@ namespace cocostudio
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);
@ -115,7 +115,7 @@ namespace cocostudio
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);

View File

@ -42,7 +42,7 @@ namespace cocostudio
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);
};
}

View File

@ -38,15 +38,15 @@ namespace cocostudio
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);
this->beginSetBasicProperties(widget);
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
for (int i = 0; i < pCocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(pCocoLoader);
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(cocoLoader);
std::string value = stChildArray[i].GetValue();
// CCLOG("key = %s, index : %d", key.c_str(), i);
//read all basic properties of widget
@ -61,7 +61,7 @@ namespace cocostudio
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);
}else if(key == P_BackGroundBoxSelectedData){
@ -70,7 +70,7 @@ namespace cocostudio
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);
}else if(key == P_FrontCrossData){
@ -79,7 +79,7 @@ namespace cocostudio
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);
}else if(key == P_BackGroundBoxDisabledData){
@ -88,7 +88,7 @@ namespace cocostudio
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);
}else if (key == P_FrontCrossDisabledData){
@ -97,7 +97,7 @@ namespace cocostudio
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);
}

View File

@ -41,7 +41,7 @@ namespace cocostudio
static void purge();
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);
};
}

View File

@ -42,18 +42,18 @@ namespace cocostudio
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);
this->beginSetBasicProperties(widget);
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) {
std::string key = stChildArray[i].GetName(pCocoLoader);
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(cocoLoader);
std::string value = stChildArray[i].GetValue();
//read all basic properties of widget
@ -70,7 +70,7 @@ namespace cocostudio
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);

View File

@ -41,7 +41,7 @@ namespace cocostudio
static void purge();
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);
};
}

View File

@ -54,14 +54,14 @@ namespace cocostudio
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);
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
this->beginSetBasicProperties(widget);
int cr=0, cg = 0, cb = 0;
@ -72,8 +72,8 @@ namespace cocostudio
Layout::Type layoutType;
int bgColorOpacity = panel->getBackGroundColorOpacity();
for (int i = 0; i < pCocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(pCocoLoader);
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(cocoLoader);
std::string value = stChildArray[i].GetValue();
//read all basic properties of widget
@ -126,7 +126,7 @@ namespace cocostudio
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);
}

View File

@ -41,7 +41,7 @@ namespace cocostudio
static void purge();
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) ;
};
}

View File

@ -35,16 +35,16 @@ namespace cocostudio
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);
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
for (int i = 0; i < pCocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(pCocoLoader);
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(cocoLoader);
std::string value = stChildArray[i].GetValue();
if (key == P_Direction) {

View File

@ -41,7 +41,7 @@ namespace cocostudio
static void purge();
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) ;
};
}

View File

@ -42,19 +42,19 @@ namespace cocostudio
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);
this->beginSetBasicProperties(widget);
float capsx = 0.0f, capsy = 0.0, capsWidth = 0.0, capsHeight = 0.0f;
int percent = loadingBar->getPercent();
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
for (int i = 0; i < pCocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(pCocoLoader);
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(cocoLoader);
std::string value = stChildArray[i].GetValue();
//read all basic properties of widget
@ -72,7 +72,7 @@ namespace cocostudio
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);

View File

@ -41,7 +41,7 @@ namespace cocostudio
static void purge();
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) ;
};
}

View File

@ -33,9 +33,9 @@ namespace cocostudio
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)

View File

@ -41,7 +41,7 @@ namespace cocostudio
static void purge();
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) ;
};
}

View File

@ -37,18 +37,18 @@ namespace cocostudio
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...
LayoutReader::setPropsFromBinary(widget, pCocoLoader, pCocoNode);
LayoutReader::setPropsFromBinary(widget, cocoLoader, cocoNode);
ScrollView* scrollView = static_cast<ScrollView*>(widget);
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
float innerWidth;
float innerHeight;
for (int i = 0; i < pCocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(pCocoLoader);
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(cocoLoader);
std::string value = stChildArray[i].GetValue();
if (key == P_InnerWidth) {
innerWidth = valueToFloat(value);

View File

@ -41,7 +41,7 @@ namespace cocostudio
static void purge();
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) ;
};
}

View File

@ -43,7 +43,7 @@ namespace cocostudio
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);
@ -51,10 +51,10 @@ namespace cocostudio
float barLength = 0.0f;
int percent = slider->getPercent();
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
for (int i = 0; i < pCocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(pCocoLoader);
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(cocoLoader);
std::string value = stChildArray[i].GetValue();
//read all basic properties of widget
@ -74,7 +74,7 @@ namespace cocostudio
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);
@ -86,7 +86,7 @@ namespace cocostudio
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);
@ -96,7 +96,7 @@ namespace cocostudio
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);
@ -106,7 +106,7 @@ namespace cocostudio
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);
@ -116,7 +116,7 @@ namespace cocostudio
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);

View File

@ -41,7 +41,7 @@ namespace cocostudio
static void purge();
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) ;
};
}

View File

@ -41,22 +41,22 @@ namespace cocostudio
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);
TextAtlas* labelAtlas = static_cast<TextAtlas*>(widget);
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
Widget::TextureResType type;
std::string charMapFileName;
std::string stringValue;
std::string startCharMap;
float itemWidth;
float itemHeight;
for (int i = 0; i < pCocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(pCocoLoader);
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(cocoLoader);
std::string value = stChildArray[i].GetValue();
//read all basic properties of widget
@ -73,7 +73,7 @@ namespace cocostudio
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;
type = imageFileNameType;

View File

@ -40,7 +40,7 @@ namespace cocostudio
static TextAtlasReader* getInstance();
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) ;
};
}

View File

@ -35,17 +35,17 @@ namespace cocostudio
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);
TextBMFont* labelBMFont = static_cast<TextBMFont*>(widget);
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
for (int i = 0; i < pCocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(pCocoLoader);
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(cocoLoader);
std::string value = stChildArray[i].GetValue();
//read all basic properties of widget
CC_BASIC_PROPERTY_BINARY_READER
@ -58,7 +58,7 @@ namespace cocostudio
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) {
labelBMFont->setFntFile(backgroundValue);
}

View File

@ -41,7 +41,7 @@ namespace cocostudio
static void purge();
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) ;
};
}

View File

@ -43,16 +43,16 @@ namespace cocostudio
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);
TextField* textField = static_cast<TextField*>(widget);
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
for (int i = 0; i < pCocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(pCocoLoader);
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(cocoLoader);
std::string value = stChildArray[i].GetValue();
//read all basic properties of widget

View File

@ -41,7 +41,7 @@ namespace cocostudio
static void purge();
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) ;
};
}

View File

@ -41,17 +41,17 @@ namespace cocostudio
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);
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
Text* label = static_cast<Text*>(widget);
for (int i = 0; i < pCocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(pCocoLoader);
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(cocoLoader);
std::string value = stChildArray[i].GetValue();
//read all basic properties of widget
CC_BASIC_PROPERTY_BINARY_READER

View File

@ -41,7 +41,7 @@ namespace cocostudio
static void purge();
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);
};
}

View File

@ -291,9 +291,9 @@ namespace cocostudio
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();
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);
for (int i = 0; i < pCocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(pCocoLoader);
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(cocoLoader);
std::string value = stChildArray[i].GetValue();
CC_BASIC_PROPERTY_BINARY_READER

View File

@ -53,7 +53,7 @@ namespace cocostudio
virtual void setColorPropsFromJsonDictionary(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);
protected:
std::string getResourcePath(const rapidjson::Value& dict,
const std::string& key,
@ -61,7 +61,7 @@ namespace cocostudio
void setAnchorPointForWidget(cocos2d::ui::Widget* widget, const rapidjson::Value&options);
std::string getResourcePath(CocoLoader* pCocoLoader,
std::string getResourcePath(CocoLoader* cocoLoader,
stExpCocoNode* pCocoNode,
cocos2d::ui::Widget::TextureResType texType);
@ -182,7 +182,7 @@ namespace cocostudio
ui::Margin mg; \
int paramType = -1; \
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(); \
if (innerKey == P_Type) { \
paramType = valueToInt(innerValue); \

View File

@ -48,7 +48,7 @@ namespace cocostudio
public:
virtual ~WidgetReaderProtocol() {};
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;
};
}