axmol/cocos2dx/extensions/CCBIReader/CCMenuItemLoader.cpp

23 lines
959 B
C++

#import "CCMenuItemLoader.h"
using namespace cocos2d;
using namespace cocos2d::extension;
#define PROPERTY_BLOCK "block"
#define PROPERTY_ISENABLED "isEnabled"
void CCMenuItemLoader::onHandlePropTypeBlock(CCNode * pNode, CCNode * pParent, const char * pPropertyName, BlockData * pBlockData, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_BLOCK) == 0) {
((CCMenuItem *)pNode)->setTarget(pBlockData->mTarget, pBlockData->mSELMenuHandler);
} else {
CCNodeLoader::onHandlePropTypeBlock(pNode, pParent, pPropertyName, pBlockData, pCCBReader);
}
}
void CCMenuItemLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_ISENABLED) == 0) {
((CCMenuItem *)pNode)->setIsEnabled(pCheck);
} else {
CCNodeLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, pCCBReader);
}
}