2012-06-01 08:07:02 +08:00
|
|
|
#import "CCMenuItemLoader.h"
|
|
|
|
|
|
|
|
using namespace cocos2d;
|
|
|
|
using namespace cocos2d::extension;
|
|
|
|
|
|
|
|
#define PROPERTY_BLOCK "block"
|
|
|
|
#define PROPERTY_ISENABLED "isEnabled"
|
|
|
|
|
2012-06-05 08:45:25 +08:00
|
|
|
void CCMenuItemLoader::onHandlePropTypeBlock(CCNode * pNode, CCNode * pParent, const char * pPropertyName, BlockData * pBlockData, CCBReader * pCCBReader) {
|
|
|
|
if(strcmp(pPropertyName, PROPERTY_BLOCK) == 0) {
|
2012-06-05 06:52:49 +08:00
|
|
|
((CCMenuItem *)pNode)->setTarget(pBlockData->mTarget, pBlockData->mSELMenuHandler);
|
2012-06-01 08:07:02 +08:00
|
|
|
} else {
|
2012-06-05 06:52:49 +08:00
|
|
|
CCNodeLoader::onHandlePropTypeBlock(pNode, pParent, pPropertyName, pBlockData, pCCBReader);
|
2012-06-01 08:07:02 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-05 08:45:25 +08:00
|
|
|
void CCMenuItemLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
|
|
|
|
if(strcmp(pPropertyName, PROPERTY_ISENABLED) == 0) {
|
2012-06-01 08:07:02 +08:00
|
|
|
((CCMenuItem *)pNode)->setIsEnabled(pCheck);
|
|
|
|
} else {
|
|
|
|
CCNodeLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, pCCBReader);
|
|
|
|
}
|
|
|
|
}
|