Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add property name to replace tag at 3.2
  • Loading branch information
githubmin committed Aug 3, 2014
commit 10b31a32e7a737519c6729e4657df94062891ef7
12 changes: 10 additions & 2 deletions spritebuilder/CCNodeLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1293,8 +1293,16 @@ void NodeLoader::onHandlePropTypeFntFile(Node * pNode, Node * pParent, const cha

void NodeLoader::onHandlePropTypeString(Node * pNode, Node * pParent, const char* pPropertyName, const char * pString, CCBReader * ccbReader) {
// ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
// It may be a custom property, add it to custom property dictionary.
_customProperties[pPropertyName] = Value(pString);
if(strcmp(pPropertyName, PROPERTY_NAME) == 0) {
#if COCOS2D_VERSION >= 0x030200
pNode->setName(pString);
#else
CCLOG("NOT supported setName() on current cocos2d version");
#endif
}else {
// It may be a custom property, add it to custom property dictionary.
_customProperties[pPropertyName] = Value(pString);
}
}

void NodeLoader::onHandlePropTypeText(Node * pNode, Node * pParent, const char* pPropertyName, const char * pText, CCBReader * ccbReader) {
Expand Down
1 change: 1 addition & 0 deletions spritebuilder/CCNodeLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace spritebuilder {
#define PROPERTY_TAG "tag"
#define PROPERTY_IGNOREANCHORPOINTFORPOSITION "ignoreAnchorPointForPosition"
#define PROPERTY_VISIBLE "visible"
#define PROPERTY_NAME "name"

#define ASSERT_FAIL_UNEXPECTED_PROPERTY(PROPERTY) cocos2d::log("Unexpected property: '%s'!\n", PROPERTY); assert(false)
#define ASSERT_FAIL_UNEXPECTED_PROPERTYTYPE(PROPERTYTYPE) cocos2d::log("Unexpected property type: '%d'!\n", PROPERTYTYPE); assert(false)
Expand Down