2012-06-13 02:59:49 +08:00
|
|
|
#include "CCLayerColorLoader.h"
|
2012-05-31 02:28:50 +08:00
|
|
|
|
2012-09-24 11:47:33 +08:00
|
|
|
|
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"
|
|
|
|
|
2013-06-20 14:15:53 +08:00
|
|
|
void LayerColorLoader::onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, ccColor3B pColor3B, CCBReader * pCCBReader) {
|
2012-11-26 21:51:05 +08:00
|
|
|
if(strcmp(pPropertyName, PROPERTY_COLOR) == 0) {
|
2013-06-20 14:15:53 +08:00
|
|
|
((LayerColor *)pNode)->setColor(pColor3B);
|
2012-05-31 02:28:50 +08:00
|
|
|
} else {
|
2013-06-20 14:15:53 +08:00
|
|
|
LayerLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pColor3B, pCCBReader);
|
2012-05-31 02:28:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:15:53 +08:00
|
|
|
void LayerColorLoader::onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
|
2012-11-26 21:51:05 +08:00
|
|
|
if(strcmp(pPropertyName, PROPERTY_OPACITY) == 0) {
|
2013-06-20 14:15:53 +08:00
|
|
|
((LayerColor *)pNode)->setOpacity(pByte);
|
2012-05-31 02:28:50 +08:00
|
|
|
} else {
|
2013-06-20 14:15:53 +08:00
|
|
|
LayerLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, pCCBReader);
|
2012-05-31 02:28:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:15:53 +08:00
|
|
|
void LayerColorLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, ccBlendFunc pBlendFunc, CCBReader * pCCBReader) {
|
2012-11-26 21:51:05 +08:00
|
|
|
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
|
2013-06-20 14:15:53 +08:00
|
|
|
((LayerColor *)pNode)->setBlendFunc(pBlendFunc);
|
2012-05-31 02:28:50 +08:00
|
|
|
} else {
|
2013-06-20 14:15:53 +08:00
|
|
|
LayerLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pBlendFunc, pCCBReader);
|
2012-05-31 02:28:50 +08:00
|
|
|
}
|
2012-07-19 17:22:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_CC_EXT_END
|