#include "CCLayerColorLoader.h" USING_NS_CC; USING_NS_CC_EXT; #define PROPERTY_COLOR "color" #define PROPERTY_OPACITY "opacity" #define PROPERTY_BLENDFUNC "blendFunc" CCLayerColor * CCLayerColorLoader::createCCNode(CCNode * pParent, CCBReader * pCCBReader) { return CCLayerColor::node(); } void CCLayerColorLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) { if(strcmp(pPropertyName, PROPERTY_COLOR) == 0) { ((CCLayerColor *)pNode)->setColor(pCCColor3B); } else { CCLayerLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pCCColor3B, pCCBReader); } } void CCLayerColorLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) { if(strcmp(pPropertyName, PROPERTY_OPACITY) == 0) { ((CCLayerColor *)pNode)->setOpacity(pByte); } else { CCLayerLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, pCCBReader); } } void CCLayerColorLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) { if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) { ((CCLayerColor *)pNode)->setBlendFunc(pCCBlendFunc); } else { CCLayerLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pCCBlendFunc, pCCBReader); } }