2012-06-13 02:59:49 +08:00
|
|
|
#include "CCLayerColorLoader.h"
|
2012-05-31 02:28:50 +08:00
|
|
|
|
2012-06-14 05:19:13 +08:00
|
|
|
USING_NS_CC;
|
2012-07-19 17:22:36 +08:00
|
|
|
|
|
|
|
NS_CC_EXT_BEGIN
|
2012-05-31 02:28:50 +08:00
|
|
|
|
|
|
|
#define PROPERTY_COLOR "color"
|
|
|
|
#define PROPERTY_OPACITY "opacity"
|
|
|
|
#define PROPERTY_BLENDFUNC "blendFunc"
|
|
|
|
|
2012-06-14 15:01:01 +08:00
|
|
|
void CCLayerColorLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
|
|
|
|
if(pPropertyName->compare(PROPERTY_COLOR) == 0) {
|
2012-05-31 02:28:50 +08:00
|
|
|
((CCLayerColor *)pNode)->setColor(pCCColor3B);
|
|
|
|
} else {
|
|
|
|
CCLayerLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pCCColor3B, pCCBReader);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-14 15:01:01 +08:00
|
|
|
void CCLayerColorLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
|
|
|
|
if(pPropertyName->compare(PROPERTY_OPACITY) == 0) {
|
2012-05-31 02:28:50 +08:00
|
|
|
((CCLayerColor *)pNode)->setOpacity(pByte);
|
|
|
|
} else {
|
|
|
|
CCLayerLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, pCCBReader);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-14 15:01:01 +08:00
|
|
|
void CCLayerColorLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
|
|
|
|
if(pPropertyName->compare(PROPERTY_BLENDFUNC) == 0) {
|
2012-05-31 02:28:50 +08:00
|
|
|
((CCLayerColor *)pNode)->setBlendFunc(pCCBlendFunc);
|
|
|
|
} else {
|
|
|
|
CCLayerLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pCCBlendFunc, pCCBReader);
|
|
|
|
}
|
2012-07-19 17:22:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_CC_EXT_END
|