2012-06-13 02:59:49 +08:00
|
|
|
#include "CCLabelBMFontLoader.h"
|
2012-05-31 02:28:50 +08:00
|
|
|
|
2013-10-15 18:00:03 +08:00
|
|
|
using namespace cocos2d;
|
2012-09-24 11:47:33 +08:00
|
|
|
|
2013-10-15 18:00:03 +08:00
|
|
|
namespace cocosbuilder {
|
2012-05-31 02:28:50 +08:00
|
|
|
|
|
|
|
#define PROPERTY_COLOR "color"
|
|
|
|
#define PROPERTY_OPACITY "opacity"
|
|
|
|
#define PROPERTY_BLENDFUNC "blendFunc"
|
2012-05-31 06:37:36 +08:00
|
|
|
#define PROPERTY_FNTFILE "fntFile"
|
|
|
|
#define PROPERTY_STRING "string"
|
2012-05-31 02:28:50 +08:00
|
|
|
|
2013-07-27 21:44:49 +08:00
|
|
|
void LabelBMFontLoader::onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, Color3B pColor3B, CCBReader * ccbReader) {
|
2012-11-26 21:51:05 +08:00
|
|
|
if(strcmp(pPropertyName, PROPERTY_COLOR) == 0) {
|
2014-03-28 10:28:44 +08:00
|
|
|
((Label *)pNode)->setColor(pColor3B);
|
2012-05-31 02:28:50 +08:00
|
|
|
} else {
|
2013-07-27 21:44:49 +08:00
|
|
|
NodeLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pColor3B, ccbReader);
|
2012-05-31 02:28:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-27 21:44:49 +08:00
|
|
|
void LabelBMFontLoader::onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * ccbReader) {
|
2012-11-26 21:51:05 +08:00
|
|
|
if(strcmp(pPropertyName, PROPERTY_OPACITY) == 0) {
|
2014-03-28 10:28:44 +08:00
|
|
|
((Label *)pNode)->setOpacity(pByte);
|
2012-05-31 02:28:50 +08:00
|
|
|
} else {
|
2013-07-27 21:44:49 +08:00
|
|
|
NodeLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, ccbReader);
|
2012-05-31 02:28:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-27 21:44:49 +08:00
|
|
|
void LabelBMFontLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, BlendFunc pBlendFunc, CCBReader * ccbReader) {
|
2012-11-26 21:51:05 +08:00
|
|
|
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
|
2014-03-28 10:28:44 +08:00
|
|
|
((Label *)pNode)->setBlendFunc(pBlendFunc);
|
2012-05-31 02:28:50 +08:00
|
|
|
} else {
|
2013-07-27 21:44:49 +08:00
|
|
|
NodeLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pBlendFunc, ccbReader);
|
2012-05-31 02:28:50 +08:00
|
|
|
}
|
2012-05-31 06:37:36 +08:00
|
|
|
}
|
|
|
|
|
2013-07-27 21:44:49 +08:00
|
|
|
void LabelBMFontLoader::onHandlePropTypeFntFile(Node * pNode, Node * pParent, const char * pPropertyName, const char* pFntFile, CCBReader * ccbReader) {
|
2012-11-26 21:51:05 +08:00
|
|
|
if(strcmp(pPropertyName, PROPERTY_FNTFILE) == 0) {
|
2014-03-28 10:28:44 +08:00
|
|
|
((Label *)pNode)->setBMFontFilePath(pFntFile);
|
2012-05-31 06:37:36 +08:00
|
|
|
} else {
|
2013-07-27 21:44:49 +08:00
|
|
|
NodeLoader::onHandlePropTypeFntFile(pNode, pParent, pPropertyName, pFntFile, ccbReader);
|
2012-05-31 06:37:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-27 21:44:49 +08:00
|
|
|
void LabelBMFontLoader::onHandlePropTypeText(Node * pNode, Node * pParent, const char * pPropertyName, const char* pText, CCBReader * ccbReader) {
|
2012-11-26 21:51:05 +08:00
|
|
|
if(strcmp(pPropertyName, PROPERTY_STRING) == 0) {
|
2014-03-28 10:28:44 +08:00
|
|
|
((Label *)pNode)->setString(pText);
|
2012-05-31 06:37:36 +08:00
|
|
|
} else {
|
2013-07-27 21:44:49 +08:00
|
|
|
NodeLoader::onHandlePropTypeText(pNode, pParent, pPropertyName, pText, ccbReader);
|
2012-05-31 06:37:36 +08:00
|
|
|
}
|
2012-07-19 17:22:36 +08:00
|
|
|
}
|
|
|
|
|
2014-06-19 19:45:24 +08:00
|
|
|
}
|