2012-06-02 06:14:18 +08:00
|
|
|
#import "CCControlLoader.h"
|
|
|
|
|
|
|
|
using namespace cocos2d;
|
|
|
|
using namespace cocos2d::extension;
|
|
|
|
|
|
|
|
#define PROPERTY_ENABLED "enabled"
|
|
|
|
#define PROPERTY_SELECTED "selected"
|
|
|
|
#define PROPERTY_CCCONTROL "ccControl"
|
|
|
|
|
2012-06-05 08:45:25 +08:00
|
|
|
void CCControlLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
|
|
|
|
if(strcmp(pPropertyName, PROPERTY_ENABLED) == 0) {
|
2012-06-02 06:14:18 +08:00
|
|
|
((CCControl *)pNode)->setIsEnabled(pCheck);
|
2012-06-05 08:45:25 +08:00
|
|
|
} else if(strcmp(pPropertyName, PROPERTY_SELECTED) == 0) {
|
2012-06-02 06:14:18 +08:00
|
|
|
((CCControl *)pNode)->setIsSelected(pCheck);
|
|
|
|
} else {
|
|
|
|
CCNodeLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, pCCBReader);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-05 08:45:25 +08:00
|
|
|
void CCControlLoader::onHandlePropTypeBlockCCControl(CCNode * pNode, CCNode * pParent, const char * pPropertyName, BlockCCControlData * pBlockCCControlData, CCBReader * pCCBReader) {
|
|
|
|
if(strcmp(pPropertyName, PROPERTY_CCCONTROL) == 0) {
|
2012-06-07 05:32:15 +08:00
|
|
|
((CCControl *)pNode)->addTargetWithActionForControlEvents(pBlockCCControlData->mTarget, pBlockCCControlData->mSELCCControlHandler, pBlockCCControlData->mControlEvents);
|
2012-06-02 06:14:18 +08:00
|
|
|
} else {
|
2012-06-05 06:52:49 +08:00
|
|
|
CCNodeLoader::onHandlePropTypeBlockCCControl(pNode, pParent, pPropertyName, pBlockCCControlData, pCCBReader);
|
2012-06-02 06:14:18 +08:00
|
|
|
}
|
|
|
|
}
|