2012-06-01 08:07:02 +08:00
|
|
|
#import "CCMenuItemImageLoader.h"
|
|
|
|
|
|
|
|
using namespace cocos2d;
|
|
|
|
using namespace cocos2d::extension;
|
|
|
|
|
|
|
|
#define PROPERTY_NORMALDISPLAYFRAME "normalSpriteFrame"
|
|
|
|
#define PROPERTY_SELECTEDDISPLAYFRAME "selectedSpriteFrame"
|
|
|
|
#define PROPERTY_DISABLEDDISPLAYFRAME "disabledSpriteFrame"
|
|
|
|
|
|
|
|
CCMenuItemImage * CCMenuItemImageLoader::createCCNode(CCNode * pParent, CCBReader * pCCBReader) {
|
|
|
|
return CCMenuItemImage::node();
|
|
|
|
}
|
|
|
|
|
2012-06-05 08:45:25 +08:00
|
|
|
void CCMenuItemImageLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
|
|
|
|
if(strcmp(pPropertyName, PROPERTY_NORMALDISPLAYFRAME) == 0) {
|
2012-06-01 08:07:02 +08:00
|
|
|
((CCMenuItemImage *)pNode)->setNormalSpriteFrame(pCCSpriteFrame);
|
2012-06-05 08:45:25 +08:00
|
|
|
} else if(strcmp(pPropertyName, PROPERTY_SELECTEDDISPLAYFRAME) == 0) {
|
2012-06-01 08:07:02 +08:00
|
|
|
((CCMenuItemImage *)pNode)->setSelectedSpriteFrame(pCCSpriteFrame);
|
2012-06-05 08:45:25 +08:00
|
|
|
} else if(strcmp(pPropertyName, PROPERTY_DISABLEDDISPLAYFRAME) == 0) {
|
2012-06-01 08:07:02 +08:00
|
|
|
((CCMenuItemImage *)pNode)->setDisabledSpriteFrame(pCCSpriteFrame);
|
|
|
|
} else {
|
|
|
|
CCMenuItemLoader::onHandlePropTypeSpriteFrame(pNode, pParent, pPropertyName, pCCSpriteFrame, pCCBReader);
|
|
|
|
}
|
|
|
|
}
|