axmol/cocos2dx/extensions/CCBReader/CCLabelBMFontLoader.cpp

50 lines
2.2 KiB
C++
Raw Normal View History

#include "CCLabelBMFontLoader.h"
USING_NS_CC;
USING_NS_CC_EXT;
#define PROPERTY_COLOR "color"
#define PROPERTY_OPACITY "opacity"
#define PROPERTY_BLENDFUNC "blendFunc"
#define PROPERTY_FNTFILE "fntFile"
#define PROPERTY_STRING "string"
void CCLabelBMFontLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_COLOR) == 0) {
((CCLabelBMFont *)pNode)->setColor(pCCColor3B);
} else {
CCNodeLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pCCColor3B, pCCBReader);
}
}
void CCLabelBMFontLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_OPACITY) == 0) {
((CCLabelBMFont *)pNode)->setOpacity(pByte);
} else {
CCNodeLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, pCCBReader);
}
}
void CCLabelBMFontLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_BLENDFUNC) == 0) {
((CCLabelBMFont *)pNode)->setBlendFunc(pCCBlendFunc);
} else {
CCNodeLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pCCBlendFunc, pCCBReader);
}
}
void CCLabelBMFontLoader::onHandlePropTypeFntFile(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pFntFile, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_FNTFILE) == 0) {
((CCLabelBMFont *)pNode)->setFntFile(pFntFile->getCString());
} else {
CCNodeLoader::onHandlePropTypeFntFile(pNode, pParent, pPropertyName, pFntFile, pCCBReader);
}
}
void CCLabelBMFontLoader::onHandlePropTypeText(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pText, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_STRING) == 0) {
((CCLabelBMFont *)pNode)->setString(pText->getCString());
} else {
CCNodeLoader::onHandlePropTypeText(pNode, pParent, pPropertyName, pText, pCCBReader);
}
}