issue #2430: Moving enum type to class for CCBReader.

This commit is contained in:
James Chen 2013-07-27 21:44:49 +08:00
parent cf7aed8789
commit e66e429bb2
52 changed files with 1112 additions and 1034 deletions

View File

@ -224,9 +224,9 @@ public:
*
* The deafult value is 1.0 if you haven't changed it before
*
* @param fScaleX The scale factor on X axis.
* @param scaleX The scale factor on X axis.
*/
virtual void setScaleX(float fScaleX);
virtual void setScaleX(float scaleX);
/**
* Returns the scale factor on X axis of this node
*
@ -242,9 +242,9 @@ public:
*
* The Default value is 1.0 if you haven't changed it before.
*
* @param fScaleY The scale factor on Y axis.
* @param scaleY The scale factor on Y axis.
*/
virtual void setScaleY(float fScaleY);
virtual void setScaleY(float scaleY);
/**
* Returns the scale factor on Y axis of this node
*

View File

@ -808,15 +808,15 @@ void Sprite::setSkewY(float sy)
SET_DIRTY_RECURSIVELY();
}
void Sprite::setScaleX(float fScaleX)
void Sprite::setScaleX(float scaleX)
{
Node::setScaleX(fScaleX);
Node::setScaleX(scaleX);
SET_DIRTY_RECURSIVELY();
}
void Sprite::setScaleY(float fScaleY)
void Sprite::setScaleY(float scaleY)
{
Node::setScaleY(fScaleY);
Node::setScaleY(scaleY);
SET_DIRTY_RECURSIVELY();
}

View File

@ -456,8 +456,8 @@ public:
/// @{
/// @name Functions inherited from Node
virtual void setScaleX(float fScaleX) override;
virtual void setScaleY(float fScaleY) override;
virtual void setScaleX(float scaleX) override;
virtual void setScaleY(float scaleY) override;
virtual void setPosition(const Point& pos) override;
virtual void setRotation(float fRotation) override;
virtual void setRotationX(float fRotationX) override;

View File

@ -17,15 +17,15 @@ NS_CC_EXT_BEGIN
// Implementation of CCBAinmationManager
CCBAnimationManager::CCBAnimationManager()
: mSequences(NULL)
, mNodeSequences(NULL)
, mBaseValues(NULL)
, mAutoPlaySequenceId(0)
, mRootNode(NULL)
, mRootContainerSize(Size::ZERO)
, mDelegate(NULL)
, mRunningSequence(NULL)
, jsControlled(false)
: _sequences(NULL)
, _nodeSequences(NULL)
, _baseValues(NULL)
, _autoPlaySequenceId(0)
, _rootNode(NULL)
, _rootContainerSize(Size::ZERO)
, _delegate(NULL)
, _runningSequence(NULL)
, _jsControlled(false)
, mOwner(NULL)
{
init();
@ -33,19 +33,19 @@ CCBAnimationManager::CCBAnimationManager()
bool CCBAnimationManager::init()
{
mSequences = new Array();
mNodeSequences = new Dictionary();
mBaseValues = new Dictionary();
_sequences = new Array();
_nodeSequences = new Dictionary();
_baseValues = new Dictionary();
mDocumentOutletNames = new Array();
mDocumentOutletNodes = new Array();
mDocumentCallbackNames = new Array();
mDocumentCallbackNodes = new Array();
mKeyframeCallbacks = new Array();
_documentOutletNames = new Array();
_documentOutletNodes = new Array();
_documentCallbackNames = new Array();
_documentCallbackNodes = new Array();
_keyframeCallbacks = new Array();
mKeyframeCallFuncs = new Dictionary();
mTarget = NULL;
mAnimationCompleteCallbackFunc = NULL;
_target = NULL;
_animationCompleteCallbackFunc = NULL;
return true;
}
@ -53,141 +53,141 @@ bool CCBAnimationManager::init()
CCBAnimationManager::~CCBAnimationManager()
{
// DictElement *pElement = NULL;
// CCDICT_FOREACH(mNodeSequences, pElement)
// CCDICT_FOREACH(_nodeSequences, pElement)
// {
// Node *node = (Node*)pElement->getIntKey();
// node->release();
// }
//
// CCDICT_FOREACH(mBaseValues, pElement)
// CCDICT_FOREACH(_baseValues, pElement)
// {
// Node *node = (Node*)pElement->getIntKey();
// node->release();
// }
mNodeSequences->release();
mBaseValues->release();
mSequences->release();
_nodeSequences->release();
_baseValues->release();
_sequences->release();
setRootNode(NULL);
setDelegate(NULL);
CC_SAFE_RELEASE(mDocumentOutletNames);
CC_SAFE_RELEASE(mDocumentOutletNodes);
CC_SAFE_RELEASE(mDocumentCallbackNames);
CC_SAFE_RELEASE(mDocumentCallbackNodes);
CC_SAFE_RELEASE(_documentOutletNames);
CC_SAFE_RELEASE(_documentOutletNodes);
CC_SAFE_RELEASE(_documentCallbackNames);
CC_SAFE_RELEASE(_documentCallbackNodes);
CC_SAFE_RELEASE(mKeyframeCallFuncs);
CC_SAFE_RELEASE(mKeyframeCallbacks);
CC_SAFE_RELEASE(mTarget);
CC_SAFE_RELEASE(_keyframeCallbacks);
CC_SAFE_RELEASE(_target);
}
Array* CCBAnimationManager::getSequences()
{
return mSequences;
return _sequences;
}
void CCBAnimationManager::setSequences(Array* seq)
{
mSequences = seq;
_sequences = seq;
}
int CCBAnimationManager::getAutoPlaySequenceId()
{
return mAutoPlaySequenceId;
return _autoPlaySequenceId;
}
void CCBAnimationManager::setAutoPlaySequenceId(int autoPlaySequenceId)
{
mAutoPlaySequenceId = autoPlaySequenceId;
_autoPlaySequenceId = autoPlaySequenceId;
}
Node* CCBAnimationManager::getRootNode()
{
return mRootNode;
return _rootNode;
}
void CCBAnimationManager::setRootNode(Node *pRootNode)
{
mRootNode = pRootNode;
_rootNode = pRootNode;
}
void CCBAnimationManager::setDocumentControllerName(const std::string &name) {
mDocumentControllerName = name;
_documentControllerName = name;
}
std::string CCBAnimationManager::getDocumentControllerName() {
return mDocumentControllerName;
return _documentControllerName;
}
void CCBAnimationManager::addDocumentCallbackNode(Node *node) {
mDocumentCallbackNodes->addObject(node);
_documentCallbackNodes->addObject(node);
}
void CCBAnimationManager::addDocumentCallbackName(std::string name) {
String *tmpName = String::create(name);
mDocumentCallbackNames->addObject(tmpName);
_documentCallbackNames->addObject(tmpName);
}
Array* CCBAnimationManager::getDocumentCallbackNames() {
return mDocumentCallbackNames;
return _documentCallbackNames;
}
Array* CCBAnimationManager::getDocumentCallbackNodes() {
return mDocumentCallbackNodes;
return _documentCallbackNodes;
}
void CCBAnimationManager::addDocumentOutletNode(Node *node) {
mDocumentOutletNodes->addObject(node);
_documentOutletNodes->addObject(node);
}
void CCBAnimationManager::addDocumentOutletName(std::string name) {
mDocumentOutletNames->addObject(String::create(name));
_documentOutletNames->addObject(String::create(name));
}
Array* CCBAnimationManager::getDocumentOutletNames() {
return mDocumentOutletNames;
return _documentOutletNames;
}
Array* CCBAnimationManager::getDocumentOutletNodes() {
return mDocumentOutletNodes;
return _documentOutletNodes;
}
std::string CCBAnimationManager::getLastCompletedSequenceName() {
return lastCompletedSequenceName;
return _lastCompletedSequenceName;
}
Array* CCBAnimationManager::getKeyframeCallbacks() {
return mKeyframeCallbacks;
return _keyframeCallbacks;
}
const Size& CCBAnimationManager::getRootContainerSize()
{
return mRootContainerSize;
return _rootContainerSize;
}
void CCBAnimationManager::setRootContainerSize(const Size &rootContainerSize)
{
mRootContainerSize.setSize(rootContainerSize.width, rootContainerSize.height);
_rootContainerSize.setSize(rootContainerSize.width, rootContainerSize.height);
}
CCBAnimationManagerDelegate* CCBAnimationManager::getDelegate()
{
return mDelegate;
return _delegate;
}
void CCBAnimationManager::setDelegate(CCBAnimationManagerDelegate *pDelegate)
{
CC_SAFE_RELEASE(dynamic_cast<Object*>(mDelegate));
mDelegate = pDelegate;
CC_SAFE_RETAIN(dynamic_cast<Object*>(mDelegate));
CC_SAFE_RELEASE(dynamic_cast<Object*>(_delegate));
_delegate = pDelegate;
CC_SAFE_RETAIN(dynamic_cast<Object*>(_delegate));
}
const char* CCBAnimationManager::getRunningSequenceName()
{
if (mRunningSequence)
if (_runningSequence)
{
return mRunningSequence->getName();
return _runningSequence->getName();
}
return NULL;
}
@ -200,7 +200,7 @@ const Size& CCBAnimationManager::getContainerSize(Node *pNode)
}
else
{
return mRootContainerSize;
return _rootContainerSize;
}
}
@ -209,34 +209,34 @@ void CCBAnimationManager::addNode(Node *pNode, Dictionary *pSeq)
{
// pNode->retain();
mNodeSequences->setObject(pSeq, (intptr_t)pNode);
_nodeSequences->setObject(pSeq, (intptr_t)pNode);
}
void CCBAnimationManager::setBaseValue(Object *pValue, Node *pNode, const char *pPropName)
void CCBAnimationManager::setBaseValue(Object *pValue, Node *pNode, const char *propName)
{
Dictionary *props = (Dictionary*)mBaseValues->objectForKey((intptr_t)pNode);
Dictionary *props = (Dictionary*)_baseValues->objectForKey((intptr_t)pNode);
if (! props)
{
props = Dictionary::create();
mBaseValues->setObject(props, (intptr_t)pNode);
_baseValues->setObject(props, (intptr_t)pNode);
// pNode->retain();
}
props->setObject(pValue, pPropName);
props->setObject(pValue, propName);
}
Object* CCBAnimationManager::getBaseValue(Node *pNode, const char* pPropName)
Object* CCBAnimationManager::getBaseValue(Node *pNode, const char* propName)
{
Dictionary *props = (Dictionary*)mBaseValues->objectForKey((intptr_t)pNode);
Dictionary *props = (Dictionary*)_baseValues->objectForKey((intptr_t)pNode);
return props->objectForKey(pPropName);
return props->objectForKey(propName);
}
int CCBAnimationManager::getSequenceId(const char* pSequenceName)
{
Object *pElement = NULL;
string seqName(pSequenceName);
CCARRAY_FOREACH(mSequences, pElement)
CCARRAY_FOREACH(_sequences, pElement)
{
CCBSequence *seq = static_cast<CCBSequence*>(pElement);
if (seqName.compare(seq->getName()) == 0)
@ -250,7 +250,7 @@ int CCBAnimationManager::getSequenceId(const char* pSequenceName)
CCBSequence* CCBAnimationManager::getSequence(int nSequenceId)
{
Object *pElement = NULL;
CCARRAY_FOREACH(mSequences, pElement)
CCARRAY_FOREACH(_sequences, pElement)
{
CCBSequence *seq = static_cast<CCBSequence*>(pElement);
if (seq->getSequenceId() == nSequenceId)
@ -265,20 +265,20 @@ CCBSequence* CCBAnimationManager::getSequence(int nSequenceId)
void CCBAnimationManager::moveAnimationsFromNode(Node* fromNode, Node* toNode) {
// Move base values
Object* baseValue = mBaseValues->objectForKey((intptr_t)fromNode);
Object* baseValue = _baseValues->objectForKey((intptr_t)fromNode);
if(baseValue) {
mBaseValues->setObject(baseValue, (intptr_t)toNode);
mBaseValues->removeObjectForKey((intptr_t)fromNode);
_baseValues->setObject(baseValue, (intptr_t)toNode);
_baseValues->removeObjectForKey((intptr_t)fromNode);
// fromNode->release();
// toNode->retain();
}
// Move seqs
Object *seqs = mNodeSequences->objectForKey((intptr_t)fromNode);
Object *seqs = _nodeSequences->objectForKey((intptr_t)fromNode);
if(seqs) {
mNodeSequences->setObject(seqs, (intptr_t)toNode);
mNodeSequences->removeObjectForKey((intptr_t)fromNode);
_nodeSequences->setObject(seqs, (intptr_t)toNode);
_nodeSequences->removeObjectForKey((intptr_t)fromNode);
// fromNode->release();
// toNode->retain();
@ -286,38 +286,38 @@ void CCBAnimationManager::moveAnimationsFromNode(Node* fromNode, Node* toNode) {
}
// Refer to CCBReader::readKeyframe() for the real type of value
ActionInterval* CCBAnimationManager::getAction(CCBKeyframe *pKeyframe0, CCBKeyframe *pKeyframe1, const char *pPropName, Node *pNode)
ActionInterval* CCBAnimationManager::getAction(CCBKeyframe *pKeyframe0, CCBKeyframe *pKeyframe1, const char *propName, Node *pNode)
{
float duration = pKeyframe1->getTime() - (pKeyframe0 ? pKeyframe0->getTime() : 0);
if (strcmp(pPropName, "rotationX") == 0)
if (strcmp(propName, "rotationX") == 0)
{
CCBValue *value = (CCBValue*)pKeyframe1->getValue();
return CCBRotateXTo::create(duration, value->getFloatValue());
}
else if(strcmp(pPropName, "rotationY") == 0)
else if(strcmp(propName, "rotationY") == 0)
{
CCBValue *value = (CCBValue*)pKeyframe1->getValue();
return CCBRotateYTo::create(duration, value->getFloatValue());
}
else if (strcmp(pPropName, "rotation") == 0)
else if (strcmp(propName, "rotation") == 0)
{
CCBValue *value = (CCBValue*)pKeyframe1->getValue();
return CCBRotateTo::create(duration, value->getFloatValue());
}
else if (strcmp(pPropName, "opacity") == 0)
else if (strcmp(propName, "opacity") == 0)
{
CCBValue *value = (CCBValue*)pKeyframe1->getValue();
return FadeTo::create(duration, value->getByteValue());
}
else if (strcmp(pPropName, "color") == 0)
else if (strcmp(propName, "color") == 0)
{
Color3BWapper* color = (Color3BWapper*)pKeyframe1->getValue();
Color3B c = color->getColor();
return TintTo::create(duration, c.r, c.g, c.b);
}
else if (strcmp(pPropName, "visible") == 0)
else if (strcmp(propName, "visible") == 0)
{
CCBValue *value = (CCBValue*)pKeyframe1->getValue();
if (value->getBoolValue())
@ -329,40 +329,40 @@ ActionInterval* CCBAnimationManager::getAction(CCBKeyframe *pKeyframe0, CCBKeyfr
return Sequence::createWithTwoActions(DelayTime::create(duration), Hide::create());
}
}
else if (strcmp(pPropName, "displayFrame") == 0)
else if (strcmp(propName, "displayFrame") == 0)
{
return Sequence::createWithTwoActions(DelayTime::create(duration),
CCBSetSpriteFrame::create((SpriteFrame *)pKeyframe1->getValue()));
}
else if (strcmp(pPropName, "position") == 0)
else if (strcmp(propName, "position") == 0)
{
// Get position type
Array *array = (Array*)getBaseValue(pNode, pPropName);
int type = ((CCBValue*)array->objectAtIndex(2))->getIntValue();
Array *array = static_cast<Array*>(getBaseValue(pNode, propName));
CCBReader::PositionType type = (CCBReader::PositionType)((CCBValue*)array->objectAtIndex(2))->getIntValue();
// Get relative position
Array *value = (Array*)pKeyframe1->getValue();
Array *value = static_cast<Array*>(pKeyframe1->getValue());
float x = ((CCBValue*)value->objectAtIndex(0))->getFloatValue();
float y = ((CCBValue*)value->objectAtIndex(1))->getFloatValue();
Size containerSize = getContainerSize(pNode->getParent());
Point absPos = getAbsolutePosition(Point(x,y), type, containerSize, pPropName);
Point absPos = getAbsolutePosition(Point(x,y), type, containerSize, propName);
return MoveTo::create(duration, absPos);
}
else if (strcmp(pPropName, "scale") == 0)
else if (strcmp(propName, "scale") == 0)
{
// Get position type
Array *array = (Array*)getBaseValue(pNode, pPropName);
int type = ((CCBValue*)array->objectAtIndex(2))->getIntValue();
Array *array = (Array*)getBaseValue(pNode, propName);
CCBReader::ScaleType type = (CCBReader::ScaleType)((CCBValue*)array->objectAtIndex(2))->getIntValue();
// Get relative scale
Array *value = (Array*)pKeyframe1->getValue();
float x = ((CCBValue*)value->objectAtIndex(0))->getFloatValue();
float y = ((CCBValue*)value->objectAtIndex(1))->getFloatValue();
if (type == kCCBScaleTypeMultiplyResolution)
if (type == CCBReader::ScaleType::MULTIPLY_RESOLUTION)
{
float resolutionScale = CCBReader::getResolutionScale();
x *= resolutionScale;
@ -371,7 +371,7 @@ ActionInterval* CCBAnimationManager::getAction(CCBKeyframe *pKeyframe0, CCBKeyfr
return ScaleTo::create(duration, x, y);
}
else if(strcmp(pPropName, "skew") == 0)
else if(strcmp(propName, "skew") == 0)
{
// Get relative skew
Array *value = (Array*)pKeyframe1->getValue();
@ -382,13 +382,13 @@ ActionInterval* CCBAnimationManager::getAction(CCBKeyframe *pKeyframe0, CCBKeyfr
}
else
{
log("CCBReader: Failed to create animation for property: %s", pPropName);
log("CCBReader: Failed to create animation for property: %s", propName);
}
return NULL;
}
void CCBAnimationManager::setAnimatedProperty(const char *pPropName, Node *pNode, Object *pValue, float fTweenDuration)
void CCBAnimationManager::setAnimatedProperty(const char *propName, Node *pNode, Object *pValue, float fTweenDuration)
{
if (fTweenDuration > 0)
{
@ -397,43 +397,43 @@ void CCBAnimationManager::setAnimatedProperty(const char *pPropName, Node *pNode
kf1->autorelease();
kf1->setValue(pValue);
kf1->setTime(fTweenDuration);
kf1->setEasingType(kCCBKeyframeEasingLinear);
kf1->setEasingType(CCBKeyframe::EasingType::LINEAR);
// Animate
ActionInterval *tweenAction = getAction(NULL, kf1, pPropName, pNode);
ActionInterval *tweenAction = getAction(NULL, kf1, propName, pNode);
pNode->runAction(tweenAction);
}
else
{
// Just set the value
if (strcmp(pPropName, "position") == 0)
if (strcmp(propName, "position") == 0)
{
// Get position type
Array *array = (Array*)getBaseValue(pNode, pPropName);
int type = ((CCBValue*)array->objectAtIndex(2))->getIntValue();
Array *array = (Array*)getBaseValue(pNode, propName);
CCBReader::PositionType type = (CCBReader::PositionType)((CCBValue*)array->objectAtIndex(2))->getIntValue();
// Get relative position
Array *value = (Array*)pValue;
float x = ((CCBValue*)value->objectAtIndex(0))->getFloatValue();
float y = ((CCBValue*)value->objectAtIndex(1))->getFloatValue();
pNode->setPosition(getAbsolutePosition(Point(x,y), type, getContainerSize(pNode->getParent()), pPropName));
pNode->setPosition(getAbsolutePosition(Point(x,y), type, getContainerSize(pNode->getParent()), propName));
}
else if (strcmp(pPropName, "scale") == 0)
else if (strcmp(propName, "scale") == 0)
{
// Get scale type
Array *array = (Array*)getBaseValue(pNode, pPropName);
int type = ((CCBValue*)array->objectAtIndex(2))->getIntValue();
Array *array = (Array*)getBaseValue(pNode, propName);
CCBReader::ScaleType type = (CCBReader::ScaleType)((CCBValue*)array->objectAtIndex(2))->getIntValue();
// Get relative scale
Array *value = (Array*)pValue;
float x = ((CCBValue*)value->objectAtIndex(0))->getFloatValue();
float y = ((CCBValue*)value->objectAtIndex(1))->getFloatValue();
setRelativeScale(pNode, x, y, type, pPropName);
setRelativeScale(pNode, x, y, type, propName);
}
else if(strcmp(pPropName, "skew") == 0)
else if(strcmp(propName, "skew") == 0)
{
// Get relative scale
Array *value = (Array*)pValue;
@ -448,41 +448,41 @@ void CCBAnimationManager::setAnimatedProperty(const char *pPropName, Node *pNode
// [node setValue:value forKey:name];
// TODO only handle rotation, opacity, displayFrame, color
if (strcmp(pPropName, "rotation") == 0)
if (strcmp(propName, "rotation") == 0)
{
float rotate = ((CCBValue*)pValue)->getFloatValue();
pNode->setRotation(rotate);
} else if(strcmp(pPropName, "rotationX") == 0)
} else if(strcmp(propName, "rotationX") == 0)
{
float rotate = ((CCBValue*)pValue)->getFloatValue();
pNode->setRotationX(rotate);
}else if(strcmp(pPropName, "rotationY") == 0)
}else if(strcmp(propName, "rotationY") == 0)
{
float rotate = ((CCBValue*)pValue)->getFloatValue();
pNode->setRotationY(rotate);
}
else if (strcmp(pPropName, "opacity") == 0)
else if (strcmp(propName, "opacity") == 0)
{
int opacity = ((CCBValue*)pValue)->getByteValue();
(dynamic_cast<RGBAProtocol*>(pNode))->setOpacity(opacity);
}
else if (strcmp(pPropName, "displayFrame") == 0)
else if (strcmp(propName, "displayFrame") == 0)
{
((Sprite*)pNode)->setDisplayFrame((SpriteFrame*)pValue);
}
else if (strcmp(pPropName, "color") == 0)
else if (strcmp(propName, "color") == 0)
{
Color3BWapper *color = (Color3BWapper*)pValue;
(dynamic_cast<RGBAProtocol*>(pNode))->setColor(color->getColor());
}
else if (strcmp(pPropName, "visible") == 0)
else if (strcmp(propName, "visible") == 0)
{
bool visible = ((CCBValue*)pValue)->getBoolValue();
pNode->setVisible(visible);
}
else
{
log("unsupported property name is %s", pPropName);
log("unsupported property name is %s", propName);
CCASSERT(false, "unsupported property now");
}
}
@ -508,72 +508,72 @@ void CCBAnimationManager::setFirstFrame(Node *pNode, CCBSequenceProperty *pSeqPr
}
}
ActionInterval* CCBAnimationManager::getEaseAction(ActionInterval *pAction, int nEasingType, float fEasingOpt)
ActionInterval* CCBAnimationManager::getEaseAction(ActionInterval *pAction, CCBKeyframe::EasingType easingType, float fEasingOpt)
{
if (dynamic_cast<Sequence*>(pAction))
{
return pAction;
}
if (nEasingType == kCCBKeyframeEasingLinear)
if (easingType == CCBKeyframe::EasingType::LINEAR)
{
return pAction;
}
else if (nEasingType == kCCBKeyframeEasingInstant)
else if (easingType == CCBKeyframe::EasingType::INSTANT)
{
return CCBEaseInstant::create(pAction);
}
else if (nEasingType == kCCBKeyframeEasingCubicIn)
else if (easingType == CCBKeyframe::EasingType::CUBIC_IN)
{
return EaseIn::create(pAction, fEasingOpt);
}
else if (nEasingType == kCCBKeyframeEasingCubicOut)
else if (easingType == CCBKeyframe::EasingType::CUBIC_OUT)
{
return EaseOut::create(pAction, fEasingOpt);
}
else if (nEasingType == kCCBKeyframeEasingCubicInOut)
else if (easingType == CCBKeyframe::EasingType::CUBIC_INOUT)
{
return EaseInOut::create(pAction, fEasingOpt);
}
else if (nEasingType == kCCBKeyframeEasingBackIn)
else if (easingType == CCBKeyframe::EasingType::BACK_IN)
{
return EaseBackIn::create(pAction);
}
else if (nEasingType == kCCBKeyframeEasingBackOut)
else if (easingType == CCBKeyframe::EasingType::BACK_OUT)
{
return EaseBackOut::create(pAction);
}
else if (nEasingType == kCCBKeyframeEasingBackInOut)
else if (easingType == CCBKeyframe::EasingType::BACK_INOUT)
{
return EaseBackInOut::create(pAction);
}
else if (nEasingType == kCCBKeyframeEasingBounceIn)
else if (easingType == CCBKeyframe::EasingType::BOUNCE_IN)
{
return EaseBounceIn::create(pAction);
}
else if (nEasingType == kCCBKeyframeEasingBounceOut)
else if (easingType == CCBKeyframe::EasingType::BOUNCE_OUT)
{
return EaseBounceOut::create(pAction);
}
else if (nEasingType == kCCBKeyframeEasingBounceInOut)
else if (easingType == CCBKeyframe::EasingType::BOUNCE_INOUT)
{
return EaseBounceInOut::create(pAction);
}
else if (nEasingType == kCCBKeyframeEasingElasticIn)
else if (easingType == CCBKeyframe::EasingType::ELASTIC_IN)
{
return EaseElasticIn::create(pAction, fEasingOpt);
}
else if (nEasingType == kCCBKeyframeEasingElasticOut)
else if (easingType == CCBKeyframe::EasingType::ELASTIC_OUT)
{
return EaseElasticOut::create(pAction, fEasingOpt);
}
else if (nEasingType == kCCBKeyframeEasingElasticInOut)
else if (easingType == CCBKeyframe::EasingType::ELASTIC_INOUT)
{
return EaseElasticInOut::create(pAction, fEasingOpt);
}
else
{
log("CCBReader: Unkown easing type %d", nEasingType);
log("CCBReader: Unkown easing type %d", easingType);
return pAction;
}
}
@ -586,7 +586,8 @@ Object* CCBAnimationManager::actionForCallbackChannel(CCBSequenceProperty* chann
Array *keyframes = channel->getKeyframes();
int numKeyframes = keyframes->count();
for (int i = 0; i < numKeyframes; ++i) {
for (int i = 0; i < numKeyframes; ++i)
{
CCBKeyframe *keyframe = (CCBKeyframe*)keyframes->objectAtIndex(i);
float timeSinceLastKeyframe = keyframe->getTime() - lastKeyframeTime;
@ -595,37 +596,52 @@ Object* CCBAnimationManager::actionForCallbackChannel(CCBSequenceProperty* chann
actions->addObject(DelayTime::create(timeSinceLastKeyframe));
}
Array* keyVal = (Array *)keyframe->getValue();
std::string selectorName = ((String *)keyVal->objectAtIndex(0))->getCString();
int selectorTarget = atoi(((String *)keyVal->objectAtIndex(1))->getCString());
Array* keyVal = static_cast<Array *>(keyframe->getValue());
std::string selectorName = static_cast<String *>(keyVal->objectAtIndex(0))->getCString();
CCBReader::TargetType selectorTarget = (CCBReader::TargetType)atoi(static_cast<String *>(keyVal->objectAtIndex(1))->getCString());
if(jsControlled) {
if(_jsControlled) {
String* callbackName = String::createWithFormat("%d:%s", selectorTarget, selectorName.c_str());
CallFunc *callback = ((CallFunc*)(mKeyframeCallFuncs->objectForKey(callbackName->getCString())))->clone();
if(callback != NULL) {
actions->addObject(callback);
}
} else {
}
else
{
Object* target = NULL;
if(selectorTarget == kCCBTargetTypeDocumentRoot) target = mRootNode;
else if (selectorTarget == kCCBTargetTypeOwner) target = mOwner;
if(target != NULL) {
if(selectorName.length() > 0) {
if(selectorTarget == CCBReader::TargetType::DOCUMENT_ROOT)
target = _rootNode;
else if (selectorTarget == CCBReader::TargetType::OWNER)
target = mOwner;
if(target != NULL)
{
if(selectorName.length() > 0)
{
SEL_CallFuncN selCallFunc = 0;
CCBSelectorResolver* targetAsCCBSelectorResolver = dynamic_cast<CCBSelectorResolver *>(target);
if(targetAsCCBSelectorResolver != NULL) {
if(targetAsCCBSelectorResolver != NULL)
{
selCallFunc = targetAsCCBSelectorResolver->onResolveCCBCCCallFuncSelector(target, selectorName.c_str ());
}
if(selCallFunc == 0) {
if(selCallFunc == 0)
{
CCLOG("Skipping selector '%s' since no CCBSelectorResolver is present.", selectorName.c_str());
} else {
}
else
{
CallFuncN *callback = CallFuncN::create(target, selCallFunc);
actions->addObject(callback);
}
} else {
}
else
{
CCLOG("Unexpected empty selector.");
}
}
@ -737,10 +753,10 @@ void CCBAnimationManager::runAnimationsForSequenceIdTweenDuration(int nSeqId, fl
{
CCASSERT(nSeqId != -1, "Sequence id couldn't be found");
mRootNode->stopAllActions();
_rootNode->stopAllActions();
DictElement* pElement = NULL;
CCDICT_FOREACH(mNodeSequences, pElement)
CCDICT_FOREACH(_nodeSequences, pElement)
{
Node *node = reinterpret_cast<Node*>(pElement->getIntKey());
node->stopAllActions();
@ -767,7 +783,7 @@ void CCBAnimationManager::runAnimationsForSequenceIdTweenDuration(int nSeqId, fl
}
// Reset the nodes that may have been changed by other timelines
Dictionary *nodeBaseValues = (Dictionary*)mBaseValues->objectForKey(pElement->getIntKey());
Dictionary *nodeBaseValues = (Dictionary*)_baseValues->objectForKey(pElement->getIntKey());
if (nodeBaseValues)
{
DictElement* pElement2 = NULL;
@ -790,25 +806,25 @@ void CCBAnimationManager::runAnimationsForSequenceIdTweenDuration(int nSeqId, fl
CCBSequence *seq = getSequence(nSeqId);
Action *completeAction = Sequence::createWithTwoActions(DelayTime::create(seq->getDuration() + fTweenDuration),
CallFunc::create( CC_CALLBACK_0(CCBAnimationManager::sequenceCompleted,this)));
mRootNode->runAction(completeAction);
_rootNode->runAction(completeAction);
// Set the running scene
if(seq->getCallbackChannel() != NULL) {
Action* action = (Action *)actionForCallbackChannel(seq->getCallbackChannel());
if(action != NULL) {
mRootNode->runAction(action);
_rootNode->runAction(action);
}
}
if(seq->getSoundChannel() != NULL) {
Action* action = (Action *)actionForSoundChannel(seq->getSoundChannel());
if(action != NULL) {
mRootNode->runAction(action);
_rootNode->runAction(action);
}
}
mRunningSequence = getSequence(nSeqId);
_runningSequence = getSequence(nSeqId);
}
void CCBAnimationManager::runAnimationsForSequenceNamedTweenDuration(const char *pName, float fTweenDuration)
@ -833,13 +849,13 @@ void CCBAnimationManager::setAnimationCompletedCallback(Object *target, SEL_Call
target->retain();
}
if (mTarget)
if (_target)
{
mTarget->release();
_target->release();
}
mTarget = target;
mAnimationCompleteCallbackFunc = callbackFunc;
_target = target;
_animationCompleteCallbackFunc = callbackFunc;
}
void CCBAnimationManager::setCallFunc(CallFunc* callFunc, const std::string &callbackNamed) {
@ -848,23 +864,23 @@ void CCBAnimationManager::setCallFunc(CallFunc* callFunc, const std::string &cal
void CCBAnimationManager::sequenceCompleted()
{
const char *runningSequenceName = mRunningSequence->getName();
int nextSeqId = mRunningSequence->getChainedSequenceId();
mRunningSequence = NULL;
const char *runningSequenceName = _runningSequence->getName();
int nextSeqId = _runningSequence->getChainedSequenceId();
_runningSequence = NULL;
if(lastCompletedSequenceName != runningSequenceName) {
lastCompletedSequenceName = runningSequenceName;
if(_lastCompletedSequenceName != runningSequenceName) {
_lastCompletedSequenceName = runningSequenceName;
}
if (mDelegate)
if (_delegate)
{
// There may be another runAnimation() call in this delegate method
// which will assign mRunningSequence
mDelegate->completedAnimationSequenceNamed(runningSequenceName);
// which will assign _runningSequence
_delegate->completedAnimationSequenceNamed(runningSequenceName);
}
if (mTarget && mAnimationCompleteCallbackFunc) {
(mTarget->*mAnimationCompleteCallbackFunc)();
if (_target && _animationCompleteCallbackFunc) {
(_target->*_animationCompleteCallbackFunc)();
}
if (nextSeqId != -1)

View File

@ -18,34 +18,34 @@ public:
class CCBAnimationManager : public Object
{
private:
Array *mSequences;
Dictionary *mNodeSequences;
Dictionary *mBaseValues;
int mAutoPlaySequenceId;
Array *_sequences;
Dictionary *_nodeSequences;
Dictionary *_baseValues;
int _autoPlaySequenceId;
Node *mRootNode;
Node *_rootNode;
Size mRootContainerSize;
Size _rootContainerSize;
CCBAnimationManagerDelegate *mDelegate;
CCBSequence *mRunningSequence;
CCBAnimationManagerDelegate *_delegate;
CCBSequence *_runningSequence;
Array *mDocumentOutletNames;
Array *mDocumentOutletNodes;
Array *mDocumentCallbackNames;
Array *mDocumentCallbackNodes;
Array *mKeyframeCallbacks;
Array *_documentOutletNames;
Array *_documentOutletNodes;
Array *_documentCallbackNames;
Array *_documentCallbackNodes;
Array *_keyframeCallbacks;
Dictionary *mKeyframeCallFuncs;
std::string mDocumentControllerName;
std::string lastCompletedSequenceName;
std::string _documentControllerName;
std::string _lastCompletedSequenceName;
SEL_CallFunc mAnimationCompleteCallbackFunc;
Object *mTarget;
SEL_CallFunc _animationCompleteCallbackFunc;
Object *_target;
public:
bool jsControlled;
bool _jsControlled;
CCBAnimationManager();
~CCBAnimationManager();
@ -92,7 +92,7 @@ public:
const Size& getContainerSize(Node* pNode);
void addNode(Node *pNode, Dictionary *pSeq);
void setBaseValue(Object *pValue, Node *pNode, const char *pPropName);
void setBaseValue(Object *pValue, Node *pNode, const char *propName);
void moveAnimationsFromNode(Node* fromNode, Node* toNode);
/** @deprecated This interface will be deprecated sooner or later.*/
@ -116,13 +116,13 @@ public:
Object* actionForSoundChannel(CCBSequenceProperty* channel);
private:
Object* getBaseValue(Node *pNode, const char* pPropName);
Object* getBaseValue(Node *pNode, const char* propName);
int getSequenceId(const char* pSequenceName);
CCBSequence* getSequence(int nSequenceId);
ActionInterval* getAction(CCBKeyframe *pKeyframe0, CCBKeyframe *pKeyframe1, const char *pPropName, Node *pNode);
void setAnimatedProperty(const char *pPropName, Node *pNode, Object *pValue, float fTweenDuraion);
ActionInterval* getAction(CCBKeyframe *pKeyframe0, CCBKeyframe *pKeyframe1, const char *propName, Node *pNode);
void setAnimatedProperty(const char *propName, Node *pNode, Object *pValue, float fTweenDuraion);
void setFirstFrame(Node *pNode, CCBSequenceProperty *pSeqProp, float fTweenDuration);
ActionInterval* getEaseAction(ActionInterval *pAction, int nEasingType, float fEasingOpt);
ActionInterval* getEaseAction(ActionInterval *pAction, CCBKeyframe::EasingType easingType, float fEasingOpt);
void runAction(Node *pNode, CCBSequenceProperty *pSeqProp, float fTweenDuration);
void sequenceCompleted();
};

View File

@ -6,11 +6,11 @@ NS_CC_EXT_BEGIN
#define PROPERTY_CCBFILE "ccbFile"
void CCBFileLoader::onHandlePropTypeCCBFile(Node * pNode, Node * pParent, const char * pPropertyName, Node * pCCBFileNode, CCBReader * pCCBReader) {
void CCBFileLoader::onHandlePropTypeCCBFile(Node * pNode, Node * pParent, const char * pPropertyName, Node * pCCBFileNode, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_CCBFILE) == 0) {
((CCBFile*)pNode)->setCCBFileNode(pCCBFileNode);
} else {
NodeLoader::onHandlePropTypeCCBFile(pNode, pParent, pPropertyName, pCCBFileNode, pCCBReader);
NodeLoader::onHandlePropTypeCCBFile(pNode, pParent, pPropertyName, pCCBFileNode, ccbReader);
}
}

View File

@ -17,7 +17,7 @@ class CCBFileLoader : public NodeLoader {
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCBFile);
virtual void onHandlePropTypeCCBFile(Node * pNode, Node * pParent, const char * pPropertyName, Node * pCCBFileNode, CCBReader * pCCBReader);
virtual void onHandlePropTypeCCBFile(Node * pNode, Node * pParent, const char * pPropertyName, Node * pCCBFileNode, CCBReader * ccbReader);
};
NS_CC_EXT_END

View File

@ -7,7 +7,7 @@ NS_CC_EXT_BEGIN
CCBKeyframe::CCBKeyframe()
: mValue(NULL)
, mTime(0.0f)
, mEasingType(0)
, mEasingType(EasingType::INSTANT)
, mEasingOpt(0.0f)
{}
@ -38,14 +38,14 @@ void CCBKeyframe::setTime(float fTime)
mTime = fTime;
}
int CCBKeyframe::getEasingType()
CCBKeyframe::EasingType CCBKeyframe::getEasingType()
{
return mEasingType;
}
void CCBKeyframe::setEasingType(int nEasingType)
void CCBKeyframe::setEasingType(CCBKeyframe::EasingType easingType)
{
mEasingType = nEasingType;
mEasingType = easingType;
}
float CCBKeyframe::getEasingOpt()

View File

@ -8,13 +8,30 @@ NS_CC_EXT_BEGIN
class CCBKeyframe : public Object
{
private:
Object *mValue;
float mTime;
int mEasingType;
float mEasingOpt;
public:
enum class EasingType
{
INSTANT,
LINEAR,
CUBIC_IN,
CUBIC_OUT,
CUBIC_INOUT,
ELASTIC_IN,
ELASTIC_OUT,
ELASTIC_INOUT,
BOUNCE_IN,
BOUNCE_OUT,
BOUNCE_INOUT,
BACK_IN,
BACK_OUT,
BACK_INOUT,
};
CCBKeyframe();
~CCBKeyframe();
@ -24,11 +41,17 @@ public:
float getTime();
void setTime(float fTime);
int getEasingType();
void setEasingType(int nEasingType);
EasingType getEasingType();
void setEasingType(EasingType easingType);
float getEasingOpt();
void setEasingOpt(float fEasingOpt);
private:
Object *mValue;
float mTime;
EasingType mEasingType;
float mEasingOpt;
};
NS_CC_EXT_END

View File

@ -14,10 +14,6 @@
#include <ctype.h>
#ifdef __CC_PLATFORM_IOS
#include <UIKit/UIDevice.h>
#endif
using namespace std;
NS_CC_EXT_BEGIN;
@ -79,7 +75,7 @@ CCBReader::CCBReader(NodeLoaderLibrary * pNodeLoaderLibrary, CCBMemberVariableAs
init();
}
CCBReader::CCBReader(CCBReader * pCCBReader)
CCBReader::CCBReader(CCBReader * ccbReader)
: mData(NULL)
, mBytes(NULL)
, mCurrentByte(-1)
@ -94,22 +90,22 @@ CCBReader::CCBReader(CCBReader * pCCBReader)
, mOwnerCallbackNodes(NULL)
, hasScriptingOwner(false)
{
this->mLoadedSpriteSheets = pCCBReader->mLoadedSpriteSheets;
this->mNodeLoaderLibrary = pCCBReader->mNodeLoaderLibrary;
this->mLoadedSpriteSheets = ccbReader->mLoadedSpriteSheets;
this->mNodeLoaderLibrary = ccbReader->mNodeLoaderLibrary;
this->mNodeLoaderLibrary->retain();
this->mCCBMemberVariableAssigner = pCCBReader->mCCBMemberVariableAssigner;
this->mCCBSelectorResolver = pCCBReader->mCCBSelectorResolver;
this->mNodeLoaderListener = pCCBReader->mNodeLoaderListener;
this->mCCBMemberVariableAssigner = ccbReader->mCCBMemberVariableAssigner;
this->mCCBSelectorResolver = ccbReader->mCCBSelectorResolver;
this->mNodeLoaderListener = ccbReader->mNodeLoaderListener;
this->mOwnerCallbackNames = pCCBReader->mOwnerCallbackNames;
this->mOwnerCallbackNodes = pCCBReader->mOwnerCallbackNodes;
this->mOwnerCallbackNames = ccbReader->mOwnerCallbackNames;
this->mOwnerCallbackNodes = ccbReader->mOwnerCallbackNodes;
this->mOwnerCallbackNodes->retain();
this->mOwnerOutletNames = pCCBReader->mOwnerOutletNames;
this->mOwnerOutletNodes = pCCBReader->mOwnerOutletNodes;
this->mOwnerOutletNames = ccbReader->mOwnerOutletNames;
this->mOwnerOutletNodes = ccbReader->mOwnerOutletNodes;
this->mOwnerOutletNodes->retain();
this->mCCBRootPath = pCCBReader->getCCBRootPath();
this->mCCBRootPath = ccbReader->getCCBRootPath();
init();
}
@ -279,13 +275,13 @@ Node* CCBReader::readNodeGraphFromData(Data *pData, Object *pOwner, const Size &
Dictionary* animationManagers = Dictionary::create();
Node *pNodeGraph = readFileWithCleanUp(true, animationManagers);
if (pNodeGraph && mActionManager->getAutoPlaySequenceId() != -1 && !jsControlled)
if (pNodeGraph && mActionManager->getAutoPlaySequenceId() != -1 && !_jsControlled)
{
// Auto play animations
mActionManager->runAnimationsForSequenceIdTweenDuration(mActionManager->getAutoPlaySequenceId(), 0);
}
// Assign actionManagers to userObject
if(jsControlled) {
if(_jsControlled) {
mNodesWithAnimationManagers = new Array();
mAnimationManagersForNodes = new Array();
}
@ -297,7 +293,7 @@ Node* CCBReader::readNodeGraphFromData(Data *pData, Object *pOwner, const Size &
CCBAnimationManager* manager = static_cast<CCBAnimationManager*>(animationManagers->objectForKey((intptr_t)pNode));
pNode->setUserObject(manager);
if (jsControlled)
if (_jsControlled)
{
mNodesWithAnimationManagers->addObject(pNode);
mAnimationManagersForNodes->addObject(manager);
@ -395,25 +391,27 @@ bool CCBReader::readHeader()
/* Read version. */
int version = this->readInt(false);
if(version != kCCBVersion) {
log("WARNING! Incompatible ccbi file version (file: %d reader: %d)", version, kCCBVersion);
if(version != CCB_VERSION) {
log("WARNING! Incompatible ccbi file version (file: %d reader: %d)", version, CCB_VERSION);
return false;
}
// Read JS check
jsControlled = this->readBool();
mActionManager->jsControlled = jsControlled;
_jsControlled = this->readBool();
mActionManager->_jsControlled = _jsControlled;
return true;
}
unsigned char CCBReader::readByte() {
unsigned char CCBReader::readByte()
{
unsigned char byte = this->mBytes[this->mCurrentByte];
this->mCurrentByte++;
return byte;
}
bool CCBReader::readBool() {
bool CCBReader::readBool()
{
return 0 == this->readByte() ? false : true;
}
@ -496,19 +494,21 @@ int CCBReader::readInt(bool pSigned) {
}
float CCBReader::readFloat() {
unsigned char type = this->readByte();
float CCBReader::readFloat()
{
FloatType type = static_cast<FloatType>(this->readByte());
switch (type) {
case kCCBFloat0:
switch (type)
{
case FloatType::_0:
return 0;
case kCCBFloat1:
case FloatType::_1:
return 1;
case kCCBFloatMinus1:
case FloatType::MINUS1:
return -1;
case kCCBFloat05:
case FloatType::_05:
return 0.5f;
case kCCBFloatInteger:
case FloatType::INTEGER:
return (float)this->readInt(true);
default:
{
@ -537,25 +537,28 @@ float CCBReader::readFloat() {
}
}
std::string CCBReader::readCachedString() {
std::string CCBReader::readCachedString()
{
int n = this->readInt(false);
return this->mStringCache[n];
}
Node * CCBReader::readNodeGraph(Node * pParent) {
Node * CCBReader::readNodeGraph(Node * pParent)
{
/* Read class name. */
std::string className = this->readCachedString();
std::string jsControlledName;
std::string _jsControlledName;
if(jsControlled) {
jsControlledName = this->readCachedString();
if(_jsControlled) {
_jsControlledName = this->readCachedString();
}
// Read assignment type and name
int memberVarAssignmentType = this->readInt(false);
TargetType memberVarAssignmentType = static_cast<TargetType>(this->readInt(false));
std::string memberVarAssignmentName;
if(memberVarAssignmentType != kCCBTargetTypeNone) {
if(memberVarAssignmentType != TargetType::NONE)
{
memberVarAssignmentName = this->readCachedString();
}
@ -576,9 +579,9 @@ Node * CCBReader::readNodeGraph(Node * pParent) {
}
// Assign controller
if(jsControlled && node == mActionManager->getRootNode())
if(_jsControlled && node == mActionManager->getRootNode())
{
mActionManager->setDocumentControllerName(jsControlledName);
mActionManager->setDocumentControllerName(_jsControlledName);
}
// Read animated properties
@ -606,7 +609,7 @@ Node * CCBReader::readNodeGraph(Node * pParent) {
for (int k = 0; k < numKeyframes; ++k)
{
CCBKeyframe *keyframe = readKeyframe(seqProp->getType());
CCBKeyframe *keyframe = readKeyframe(static_cast<PropertyType>(seqProp->getType()));
seqProp->getKeyframes()->addObject(keyframe);
}
@ -654,16 +657,16 @@ Node * CCBReader::readNodeGraph(Node * pParent) {
[[JSCocoa sharedController] setObject:node withName:memberVarAssignmentName];
}*/
#else
if (memberVarAssignmentType != kCCBTargetTypeNone)
if (memberVarAssignmentType != TargetType::NONE)
{
if(!jsControlled)
if(!_jsControlled)
{
Object * target = NULL;
if(memberVarAssignmentType == kCCBTargetTypeDocumentRoot)
if(memberVarAssignmentType == TargetType::DOCUMENT_ROOT)
{
target = mActionManager->getRootNode();
}
else if(memberVarAssignmentType == kCCBTargetTypeOwner)
else if(memberVarAssignmentType == TargetType::OWNER)
{
target = this->mOwner;
}
@ -673,13 +676,15 @@ Node * CCBReader::readNodeGraph(Node * pParent) {
CCBMemberVariableAssigner * targetAsCCBMemberVariableAssigner = dynamic_cast<CCBMemberVariableAssigner *>(target);
bool assigned = false;
if (memberVarAssignmentType != kCCBTargetTypeNone)
if (memberVarAssignmentType != TargetType::NONE)
{
if(targetAsCCBMemberVariableAssigner != NULL) {
if(targetAsCCBMemberVariableAssigner != NULL)
{
assigned = targetAsCCBMemberVariableAssigner->onAssignCCBMemberVariable(target, memberVarAssignmentName.c_str(), node);
}
if(!assigned && this->mCCBMemberVariableAssigner != NULL) {
if(!assigned && this->mCCBMemberVariableAssigner != NULL)
{
assigned = this->mCCBMemberVariableAssigner->onAssignCCBMemberVariable(target, memberVarAssignmentName.c_str(), node);
}
}
@ -687,10 +692,13 @@ Node * CCBReader::readNodeGraph(Node * pParent) {
}
else
{
if(memberVarAssignmentType == kCCBTargetTypeDocumentRoot) {
if(memberVarAssignmentType == TargetType::DOCUMENT_ROOT)
{
mActionManager->addDocumentOutletName(memberVarAssignmentName);
mActionManager->addDocumentOutletNode(node);
} else {
}
else
{
mOwnerOutletNames.push_back(memberVarAssignmentName);
mOwnerOutletNodes->addObject(node);
}
@ -698,11 +706,11 @@ Node * CCBReader::readNodeGraph(Node * pParent) {
}
// Assign custom properties.
if (ccNodeLoader->getCustomProperties()->count() > 0) {
if (ccNodeLoader->getCustomProperties()->count() > 0)
{
bool customAssigned = false;
if(!jsControlled)
if(!_jsControlled)
{
Object * target = node;
if(target != NULL)
@ -753,38 +761,38 @@ Node * CCBReader::readNodeGraph(Node * pParent) {
return node;
}
CCBKeyframe* CCBReader::readKeyframe(int type)
CCBKeyframe* CCBReader::readKeyframe(PropertyType type)
{
CCBKeyframe *keyframe = new CCBKeyframe();
keyframe->autorelease();
keyframe->setTime(readFloat());
int easingType = readInt(false);
CCBKeyframe::EasingType easingType = static_cast<CCBKeyframe::EasingType>(readInt(false));
float easingOpt = 0;
Object *value = NULL;
if (easingType == kCCBKeyframeEasingCubicIn
|| easingType == kCCBKeyframeEasingCubicOut
|| easingType == kCCBKeyframeEasingCubicInOut
|| easingType == kCCBKeyframeEasingElasticIn
|| easingType == kCCBKeyframeEasingElasticOut
|| easingType == kCCBKeyframeEasingElasticInOut)
if (easingType == CCBKeyframe::EasingType::CUBIC_IN
|| easingType == CCBKeyframe::EasingType::CUBIC_OUT
|| easingType == CCBKeyframe::EasingType::CUBIC_INOUT
|| easingType == CCBKeyframe::EasingType::ELASTIC_IN
|| easingType == CCBKeyframe::EasingType::ELASTIC_OUT
|| easingType == CCBKeyframe::EasingType::ELASTIC_INOUT)
{
easingOpt = readFloat();
}
keyframe->setEasingType(easingType);
keyframe->setEasingOpt(easingOpt);
if (type == kCCBPropTypeCheck)
if (type == PropertyType::CHECK)
{
value = CCBValue::create(readBool());
}
else if (type == kCCBPropTypeByte)
else if (type == PropertyType::BYTE)
{
value = CCBValue::create(readByte());
}
else if (type == kCCBPropTypeColor3)
else if (type == PropertyType::COLOR3)
{
int r = readByte();
int g = readByte();
@ -793,12 +801,12 @@ CCBKeyframe* CCBReader::readKeyframe(int type)
Color3B c = Color3B(r,g,b);
value = Color3BWapper::create(c);
}
else if (type == kCCBPropTypeDegrees)
else if (type == PropertyType::DEGREES)
{
value = CCBValue::create(readFloat());
}
else if (type == kCCBPropTypeScaleLock || type == kCCBPropTypePosition
|| type == kCCBPropTypeFloatXY)
else if (type == PropertyType::SCALE_LOCK || type == PropertyType::POSITION
|| type == PropertyType::FLOAT_XY)
{
float a = readFloat();
float b = readFloat();
@ -807,7 +815,7 @@ CCBKeyframe* CCBReader::readKeyframe(int type)
CCBValue::create(b),
NULL);
}
else if (type == kCCBPropTypeSpriteFrame)
else if (type == PropertyType::SPRITEFRAME)
{
std::string spriteSheet = readCachedString();
std::string spriteFile = readCachedString();
@ -846,7 +854,8 @@ CCBKeyframe* CCBReader::readKeyframe(int type)
}
bool CCBReader::readCallbackKeyframesForSeq(CCBSequence* seq) {
bool CCBReader::readCallbackKeyframesForSeq(CCBSequence* seq)
{
int numKeyframes = readInt(false);
if(!numKeyframes) return true;
@ -870,7 +879,7 @@ bool CCBReader::readCallbackKeyframesForSeq(CCBSequence* seq) {
keyframe->setTime(time);
keyframe->setValue(value);
if(jsControlled) {
if(_jsControlled) {
string callbackIdentifier;
mActionManager->getKeyframeCallbacks()->addObject(String::createWithFormat("%d:%s",callbackType, callbackName.c_str()));
}
@ -983,7 +992,7 @@ bool CCBReader::endsWith(const char* pString, const char* pEnding) {
}
bool CCBReader::isJSControlled() {
return jsControlled;
return _jsControlled;
}
void CCBReader::addOwnerCallbackName(std::string name) {

View File

@ -28,109 +28,7 @@
return NULL; \
}
#define kCCBVersion 5
enum {
kCCBPropTypePosition = 0,
kCCBPropTypeSize,
kCCBPropTypePoint,
kCCBPropTypePointLock,
kCCBPropTypeScaleLock,
kCCBPropTypeDegrees,
kCCBPropTypeInteger,
kCCBPropTypeFloat,
kCCBPropTypeFloatVar,
kCCBPropTypeCheck,
kCCBPropTypeSpriteFrame,
kCCBPropTypeTexture,
kCCBPropTypeByte,
kCCBPropTypeColor3,
kCCBPropTypeColor4FVar,
kCCBPropTypeFlip,
kCCBPropTypeBlendmode,
kCCBPropTypeFntFile,
kCCBPropTypeText,
kCCBPropTypeFontTTF,
kCCBPropTypeIntegerLabeled,
kCCBPropTypeBlock,
kCCBPropTypeAnimation,
kCCBPropTypeCCBFile,
kCCBPropTypeString,
kCCBPropTypeBlockControl,
kCCBPropTypeFloatScale,
kCCBPropTypeFloatXY
};
enum {
kCCBFloat0 = 0,
kCCBFloat1,
kCCBFloatMinus1,
kCCBFloat05,
kCCBFloatInteger,
kCCBFloatFull
};
enum {
kCCBPlatformAll = 0,
kCCBPlatformIOS,
kCCBPlatformMac
};
enum {
kCCBTargetTypeNone = 0,
kCCBTargetTypeDocumentRoot = 1,
kCCBTargetTypeOwner = 2,
};
enum
{
kCCBKeyframeEasingInstant,
kCCBKeyframeEasingLinear,
kCCBKeyframeEasingCubicIn,
kCCBKeyframeEasingCubicOut,
kCCBKeyframeEasingCubicInOut,
kCCBKeyframeEasingElasticIn,
kCCBKeyframeEasingElasticOut,
kCCBKeyframeEasingElasticInOut,
kCCBKeyframeEasingBounceIn,
kCCBKeyframeEasingBounceOut,
kCCBKeyframeEasingBounceInOut,
kCCBKeyframeEasingBackIn,
kCCBKeyframeEasingBackOut,
kCCBKeyframeEasingBackInOut,
};
enum
{
kCCBPositionTypeRelativeBottomLeft,
kCCBPositionTypeRelativeTopLeft,
kCCBPositionTypeRelativeTopRight,
kCCBPositionTypeRelativeBottomRight,
kCCBPositionTypePercent,
kCCBPositionTypeMultiplyResolution,
};
enum
{
kCCBSizeTypeAbsolute,
kCCBSizeTypePercent,
kCCBSizeTypeRelativeContainer,
kCCBSizeTypeHorizontalPercent,
kCCBSizeTypeVerticalPercent,
kCCBSizeTypeMultiplyResolution,
};
enum
{
kCCBScaleTypeAbsolute,
kCCBScaleTypeMultiplyResolution
};
#define CCB_VERSION 5
NS_CC_EXT_BEGIN
@ -167,43 +65,87 @@ class CCBKeyframe;
*/
class CCBReader : public Object
{
private:
Data *mData;
unsigned char *mBytes;
int mCurrentByte;
int mCurrentBit;
std::vector<std::string> mStringCache;
std::set<std::string> mLoadedSpriteSheets;
Object *mOwner;
CCBAnimationManager *mActionManager; //retain
Dictionary* mActionManagers;
std::set<std::string> *mAnimatedProps;
NodeLoaderLibrary *mNodeLoaderLibrary;
NodeLoaderListener *mNodeLoaderListener;
CCBMemberVariableAssigner *mCCBMemberVariableAssigner;
CCBSelectorResolver *mCCBSelectorResolver;
std::vector<std::string> mOwnerOutletNames;
Array* mOwnerOutletNodes;
Array* mNodesWithAnimationManagers;
Array* mAnimationManagersForNodes;
std::vector<std::string> mOwnerCallbackNames;
Array* mOwnerCallbackNodes;
std::string mCCBRootPath;
bool hasScriptingOwner;
bool init();
public:
enum class PropertyType {
POSITION = 0,
SIZE,
POINT,
POINT_LOCK,
SCALE_LOCK,
DEGREES,
INTEGER,
FLOAT,
FLOAT_VAR,
CHECK,
SPRITEFRAME,
TEXTURE,
BYTE,
COLOR3,
COLOR4F_VAR,
FLIP,
BLEND_MODE,
FNT_FILE,
TEXT,
FONT_TTF,
INTEGER_LABELED,
BLOCK,
ANIMATION,
CCB_FILE,
STRING,
BLOCK_CONTROL,
FLOAT_SCALE,
FLOAT_XY
};
enum class FloatType {
_0 = 0,
_1,
MINUS1,
_05,
INTEGER,
FULL
};
enum class PlatformType {
ALL = 0,
IOS,
MAC
};
enum class TargetType {
NONE = 0,
DOCUMENT_ROOT = 1,
OWNER = 2,
};
enum class PositionType
{
RELATIVE_BOTTOM_LEFT,
RELATIVE_TOP_LEFT,
RELATIVE_TOP_RIGHT,
RELATIVE_BOTTOM_RIGHT,
PERCENT,
MULTIPLY_RESOLUTION,
};
enum class SizeType
{
ABSOLUTE,
PERCENT,
RELATIVE_CONTAINER,
HORIZONTAL_PERCENT,
VERTICAL_PERCENT,
MULTIPLY_RESOLUTION,
};
enum class ScaleType
{
ABSOLUTE,
MULTIPLY_RESOLUTION
};
bool jsControlled;
CCBReader(NodeLoaderLibrary *pNodeLoaderLibrary, CCBMemberVariableAssigner *pCCBMemberVariableAssigner = NULL, CCBSelectorResolver *pCCBSelectorResolver = NULL, NodeLoaderListener *pNodeLoaderListener = NULL);
CCBReader(CCBReader *pCCBReader);
CCBReader(CCBReader *ccbReader);
virtual ~CCBReader();
CCBReader();
@ -279,7 +221,7 @@ public:
private:
void cleanUpNodeGraph(Node *pNode);
bool readSequences();
CCBKeyframe* readKeyframe(int type);
CCBKeyframe* readKeyframe(PropertyType type);
bool readHeader();
bool readStringCache();
@ -291,6 +233,41 @@ private:
void alignBits();
friend class NodeLoader;
private:
Data *mData;
unsigned char *mBytes;
int mCurrentByte;
int mCurrentBit;
std::vector<std::string> mStringCache;
std::set<std::string> mLoadedSpriteSheets;
Object *mOwner;
CCBAnimationManager *mActionManager; //retain
Dictionary* mActionManagers;
std::set<std::string> *mAnimatedProps;
NodeLoaderLibrary *mNodeLoaderLibrary;
NodeLoaderListener *mNodeLoaderListener;
CCBMemberVariableAssigner *mCCBMemberVariableAssigner;
CCBSelectorResolver *mCCBSelectorResolver;
std::vector<std::string> mOwnerOutletNames;
Array* mOwnerOutletNodes;
Array* mNodesWithAnimationManagers;
Array* mAnimationManagersForNodes;
std::vector<std::string> mOwnerCallbackNames;
Array* mOwnerCallbackNodes;
std::string mCCBRootPath;
bool _jsControlled;
bool hasScriptingOwner;
bool init();
};
// end of effects group

View File

@ -39,9 +39,9 @@ int CCBSequenceProperty::getType()
return mType;
}
void CCBSequenceProperty::setType(int nType)
void CCBSequenceProperty::setType(int type)
{
mType = nType;
mType = type;
}
Array* CCBSequenceProperty::getKeyframes()

View File

@ -24,7 +24,7 @@ public:
void setName(const char* pName);
int getType();
void setType(int nType);
void setType(int type);
Array* getKeyframes();
};

View File

@ -34,7 +34,7 @@ CCBValue* CCBValue::create(int nValue)
if (ret)
{
ret->mValue.nValue = nValue;
ret->mType = kIntValue;
ret->mType = TYPE_INT;
ret->autorelease();
}
@ -47,7 +47,7 @@ CCBValue* CCBValue::create(float fValue)
if (ret)
{
ret->mValue.fValue = fValue;
ret->mType = kFloatValue;
ret->mType = TYPE_FLOAT;
ret->autorelease();
}
@ -60,7 +60,7 @@ CCBValue* CCBValue::create(bool vValue)
if (ret)
{
ret->mValue.nValue = vValue ? 1 : 0;
ret->mType = kBoolValue;
ret->mType = TYPE_BOOL;
ret->autorelease();
}
@ -73,7 +73,7 @@ CCBValue* CCBValue::create(unsigned char byte)
if (ret)
{
ret->mValue.nValue = byte;
ret->mType = kUnsignedCharValue;
ret->mType = TYPE_UNSIGNED_CHAR;
ret->autorelease();
}
@ -86,7 +86,7 @@ CCBValue* CCBValue::create(const char *pStringValue)
if (ret)
{
ret->_value = pStringValue;
ret->mType = kStringValue;
ret->mType = TYPE_STRING;
ret->autorelease();
}
@ -100,7 +100,7 @@ CCBValue* CCBValue::create(Array *pArrValue)
if (ret)
{
ret->_arrValue = pArrValue;
ret->mType = kArrayValue;
ret->mType = TYPE_ARRAY;
ret->autorelease();
}
@ -110,34 +110,35 @@ CCBValue* CCBValue::create(Array *pArrValue)
int CCBValue::getIntValue()
{
assert(mType == kIntValue);
CCASSERT(mType == TYPE_INT, "The type of CCBValue isn't integer.");
return mValue.nValue;
}
float CCBValue::getFloatValue()
{
assert(mType == kFloatValue);
CCASSERT(mType == TYPE_FLOAT, "The type of CCBValue isn't float.");
return mValue.fValue;
}
bool CCBValue::getBoolValue()
{
assert(mType == kBoolValue);
CCASSERT(mType == TYPE_BOOL, "The type of CCBValue isn't boolean.");
return mValue.nValue == 1 ? true : false;
}
unsigned char CCBValue::getByteValue()
{
assert(mType == kUnsignedCharValue);
CCASSERT(mType == TYPE_UNSIGNED_CHAR, "The type of CCBValue isn't unsigned char.");
return (unsigned char)(mValue.nValue);
}
Array* CCBValue::getArrayValue() {
assert(mType == kArrayValue);
Array* CCBValue::getArrayValue()
{
CCASSERT(mType == TYPE_ARRAY, "The type of CCBValue isn't array.");
return _arrValue;
}
@ -145,12 +146,12 @@ Array* CCBValue::getArrayValue() {
const char* CCBValue::getStringValue()
{
assert(mType == kStringValue);
CCASSERT(mType == TYPE_STRING, "The type of CCBValue isn't string.");
return _value.c_str();
}
int CCBValue::getType()
CCBValue::Type CCBValue::getType()
{
return mType;
}

View File

@ -21,30 +21,22 @@ public:
const Color3B& getColor() const;
};
enum
{
kIntValue,
kFloatValue,
kBoolValue,
kUnsignedCharValue,
kStringValue,
kArrayValue
};
class CCBValue : public Object
{
private:
union
{
int nValue;
float fValue;
} mValue;
std::string _value;
Array* _arrValue;
int mType;
public:
enum Type
{
TYPE_INT,
TYPE_FLOAT,
TYPE_BOOL,
TYPE_UNSIGNED_CHAR,
TYPE_STRING,
TYPE_ARRAY
};
static CCBValue* create(int nValue);
static CCBValue* create(bool bValue);
static CCBValue* create(float fValue);
@ -60,7 +52,18 @@ public:
const char* getStringValue();
Array *getArrayValue();
int getType();
Type getType();
private:
union
{
int nValue;
float fValue;
} mValue;
std::string _value;
Array* _arrValue;
Type mType;
};
NS_CC_EXT_END

View File

@ -22,15 +22,15 @@ NS_CC_EXT_BEGIN;
#define PROPERTY_BACKGROUNDSPRITEFRAME_HIGHLIGHTED "backgroundSpriteFrame|2"
#define PROPERTY_BACKGROUNDSPRITEFRAME_DISABLED "backgroundSpriteFrame|3"
void ControlButtonLoader::onHandlePropTypeCheck(Node * pNode, Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
void ControlButtonLoader::onHandlePropTypeCheck(Node * pNode, Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_ZOOMONTOUCHDOWN) == 0) {
((ControlButton *)pNode)->setZoomOnTouchDown(pCheck);
} else {
ControlLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, pCCBReader);
ControlLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, ccbReader);
}
}
void ControlButtonLoader::onHandlePropTypeString(Node * pNode, Node * pParent, const char * pPropertyName, const char * pString, CCBReader * pCCBReader) {
void ControlButtonLoader::onHandlePropTypeString(Node * pNode, Node * pParent, const char * pPropertyName, const char * pString, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_TITLE_NORMAL) == 0) {
((ControlButton *)pNode)->setTitleForState(String::create(pString), Control::State::NORMAL);
} else if(strcmp(pPropertyName, PROPERTY_TITLE_HIGHLIGHTED) == 0) {
@ -38,11 +38,11 @@ void ControlButtonLoader::onHandlePropTypeString(Node * pNode, Node * pParent, c
} else if(strcmp(pPropertyName, PROPERTY_TITLE_DISABLED) == 0) {
((ControlButton *)pNode)->setTitleForState(String::create(pString), Control::State::DISABLED);
} else {
ControlLoader::onHandlePropTypeString(pNode, pParent, pPropertyName, pString, pCCBReader);
ControlLoader::onHandlePropTypeString(pNode, pParent, pPropertyName, pString, ccbReader);
}
}
void ControlButtonLoader::onHandlePropTypeFontTTF(Node * pNode, Node * pParent, const char * pPropertyName, const char * pFontTTF, CCBReader * pCCBReader) {
void ControlButtonLoader::onHandlePropTypeFontTTF(Node * pNode, Node * pParent, const char * pPropertyName, const char * pFontTTF, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_TITLETTF_NORMAL) == 0) {
((ControlButton *)pNode)->setTitleTTFForState(pFontTTF, Control::State::NORMAL);
} else if(strcmp(pPropertyName, PROPERTY_TITLETTF_HIGHLIGHTED) == 0) {
@ -50,11 +50,11 @@ void ControlButtonLoader::onHandlePropTypeFontTTF(Node * pNode, Node * pParent,
} else if(strcmp(pPropertyName, PROPERTY_TITLETTF_DISABLED) == 0) {
((ControlButton *)pNode)->setTitleTTFForState(pFontTTF, Control::State::DISABLED);
} else {
ControlLoader::onHandlePropTypeFontTTF(pNode, pParent, pPropertyName, pFontTTF, pCCBReader);
ControlLoader::onHandlePropTypeFontTTF(pNode, pParent, pPropertyName, pFontTTF, ccbReader);
}
}
void ControlButtonLoader::onHandlePropTypeFloatScale(Node * pNode, Node * pParent, const char * pPropertyName, float pFloatScale, CCBReader * pCCBReader) {
void ControlButtonLoader::onHandlePropTypeFloatScale(Node * pNode, Node * pParent, const char * pPropertyName, float pFloatScale, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_TITLETTFSIZE_NORMAL) == 0) {
((ControlButton *)pNode)->setTitleTTFSizeForState(pFloatScale, Control::State::NORMAL);
} else if(strcmp(pPropertyName, PROPERTY_TITLETTFSIZE_HIGHLIGHTED) == 0) {
@ -62,27 +62,27 @@ void ControlButtonLoader::onHandlePropTypeFloatScale(Node * pNode, Node * pParen
} else if(strcmp(pPropertyName, PROPERTY_TITLETTFSIZE_DISABLED) == 0) {
((ControlButton *)pNode)->setTitleTTFSizeForState(pFloatScale, Control::State::DISABLED);
} else {
ControlLoader::onHandlePropTypeFloatScale(pNode, pParent, pPropertyName, pFloatScale, pCCBReader);
ControlLoader::onHandlePropTypeFloatScale(pNode, pParent, pPropertyName, pFloatScale, ccbReader);
}
}
void ControlButtonLoader::onHandlePropTypePoint(Node * pNode, Node * pParent, const char * pPropertyName, Point pPoint, CCBReader * pCCBReader) {
void ControlButtonLoader::onHandlePropTypePoint(Node * pNode, Node * pParent, const char * pPropertyName, Point pPoint, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_LABELANCHORPOINT) == 0) {
((ControlButton *)pNode)->setLabelAnchorPoint(pPoint);
} else {
ControlLoader::onHandlePropTypePoint(pNode, pParent, pPropertyName, pPoint, pCCBReader);
ControlLoader::onHandlePropTypePoint(pNode, pParent, pPropertyName, pPoint, ccbReader);
}
}
void ControlButtonLoader::onHandlePropTypeSize(Node * pNode, Node * pParent, const char * pPropertyName, Size pSize, CCBReader * pCCBReader) {
void ControlButtonLoader::onHandlePropTypeSize(Node * pNode, Node * pParent, const char * pPropertyName, Size pSize, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_PREFEREDSIZE) == 0) {
((ControlButton *)pNode)->setPreferredSize(pSize);
} else {
ControlLoader::onHandlePropTypeSize(pNode, pParent, pPropertyName, pSize, pCCBReader);
ControlLoader::onHandlePropTypeSize(pNode, pParent, pPropertyName, pSize, ccbReader);
}
}
void ControlButtonLoader::onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, const char * pPropertyName, SpriteFrame * pSpriteFrame, CCBReader * pCCBReader) {
void ControlButtonLoader::onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, const char * pPropertyName, SpriteFrame * pSpriteFrame, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_BACKGROUNDSPRITEFRAME_NORMAL) == 0) {
if(pSpriteFrame != NULL) {
((ControlButton *)pNode)->setBackgroundSpriteFrameForState(pSpriteFrame, Control::State::NORMAL);
@ -96,11 +96,11 @@ void ControlButtonLoader::onHandlePropTypeSpriteFrame(Node * pNode, Node * pPare
((ControlButton *)pNode)->setBackgroundSpriteFrameForState(pSpriteFrame, Control::State::DISABLED);
}
} else {
ControlLoader::onHandlePropTypeSpriteFrame(pNode, pParent, pPropertyName, pSpriteFrame, pCCBReader);
ControlLoader::onHandlePropTypeSpriteFrame(pNode, pParent, pPropertyName, pSpriteFrame, ccbReader);
}
}
void ControlButtonLoader::onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, Color3B pColor3B, CCBReader * pCCBReader) {
void ControlButtonLoader::onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, Color3B pColor3B, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_TITLECOLOR_NORMAL) == 0) {
((ControlButton *)pNode)->setTitleColorForState(pColor3B, Control::State::NORMAL);
} else if(strcmp(pPropertyName, PROPERTY_TITLECOLOR_HIGHLIGHTED) == 0) {
@ -108,7 +108,7 @@ void ControlButtonLoader::onHandlePropTypeColor3(Node * pNode, Node * pParent, c
} else if(strcmp(pPropertyName, PROPERTY_TITLECOLOR_DISABLED) == 0) {
((ControlButton *)pNode)->setTitleColorForState(pColor3B, Control::State::DISABLED);
} else {
ControlLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pColor3B, pCCBReader);
ControlLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pColor3B, ccbReader);
}
}

View File

@ -17,14 +17,14 @@ class ControlButtonLoader : public ControlLoader {
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(ControlButton);
virtual void onHandlePropTypeCheck(Node * pNode, Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader);
virtual void onHandlePropTypeString(Node * pNode, Node * pParent, const char * pPropertyName, const char * pString, CCBReader * pCCBReader);
virtual void onHandlePropTypeFontTTF(Node * pNode, Node * pParent, const char * pPropertyName, const char * pFontTTF, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloatScale(Node * pNode, Node * pParent, const char * pPropertyName, float pFloatScale, CCBReader * pCCBReader);
virtual void onHandlePropTypePoint(Node * pNode, Node * pParent, const char * pPropertyName, Point pPoint, CCBReader * pCCBReader);
virtual void onHandlePropTypeSize(Node * pNode, Node * pParent, const char * pPropertyName, Size pSize, CCBReader * pCCBReader);
virtual void onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, const char * pPropertyName, SpriteFrame * pSpriteFrame, CCBReader * pCCBReader);
virtual void onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, Color3B pColor3B, CCBReader * pCCBReader);
virtual void onHandlePropTypeCheck(Node * pNode, Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * ccbReader);
virtual void onHandlePropTypeString(Node * pNode, Node * pParent, const char * pPropertyName, const char * pString, CCBReader * ccbReader);
virtual void onHandlePropTypeFontTTF(Node * pNode, Node * pParent, const char * pPropertyName, const char * pFontTTF, CCBReader * ccbReader);
virtual void onHandlePropTypeFloatScale(Node * pNode, Node * pParent, const char * pPropertyName, float pFloatScale, CCBReader * ccbReader);
virtual void onHandlePropTypePoint(Node * pNode, Node * pParent, const char * pPropertyName, Point pPoint, CCBReader * ccbReader);
virtual void onHandlePropTypeSize(Node * pNode, Node * pParent, const char * pPropertyName, Size pSize, CCBReader * ccbReader);
virtual void onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, const char * pPropertyName, SpriteFrame * pSpriteFrame, CCBReader * ccbReader);
virtual void onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, Color3B pColor3B, CCBReader * ccbReader);
};
NS_CC_EXT_END

View File

@ -7,21 +7,21 @@ NS_CC_EXT_BEGIN
#define PROPERTY_SELECTED "selected"
#define PROPERTY_CCCONTROL "ccControl"
void ControlLoader::onHandlePropTypeCheck(Node * pNode, Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
void ControlLoader::onHandlePropTypeCheck(Node * pNode, Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_ENABLED) == 0) {
((Control *)pNode)->setEnabled(pCheck);
} else if(strcmp(pPropertyName, PROPERTY_SELECTED) == 0) {
((Control *)pNode)->setSelected(pCheck);
} else {
NodeLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, pCCBReader);
NodeLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, ccbReader);
}
}
void ControlLoader::onHandlePropTypeBlockControl(Node * pNode, Node * pParent, const char * pPropertyName, BlockControlData * pBlockControlData, CCBReader * pCCBReader) {
void ControlLoader::onHandlePropTypeBlockControl(Node * pNode, Node * pParent, const char * pPropertyName, BlockControlData * pBlockControlData, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_CCCONTROL) == 0) {
((Control *)pNode)->addTargetWithActionForControlEvents(pBlockControlData->mTarget, pBlockControlData->mSELControlHandler, pBlockControlData->mControlEvents);
((Control *)pNode)->addTargetWithActionForControlEvents(pBlockControlData->_target, pBlockControlData->mSELControlHandler, pBlockControlData->mControlEvents);
} else {
NodeLoader::onHandlePropTypeBlockControl(pNode, pParent, pPropertyName, pBlockControlData, pCCBReader);
NodeLoader::onHandlePropTypeBlockControl(pNode, pParent, pPropertyName, pBlockControlData, ccbReader);
}
}

View File

@ -16,8 +16,8 @@ class ControlLoader : public NodeLoader {
protected:
CCB_PURE_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(Control);
virtual void onHandlePropTypeBlockControl(Node * pNode, Node * pParent, const char * pPropertyName, BlockControlData * pBlockControlData, CCBReader * pCCBReader);
virtual void onHandlePropTypeCheck(Node * pNode, Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlockControl(Node * pNode, Node * pParent, const char * pPropertyName, BlockControlData * pBlockControlData, CCBReader * ccbReader);
virtual void onHandlePropTypeCheck(Node * pNode, Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * ccbReader);
};
NS_CC_EXT_END

View File

@ -10,43 +10,43 @@ NS_CC_EXT_BEGIN
#define PROPERTY_FNTFILE "fntFile"
#define PROPERTY_STRING "string"
void LabelBMFontLoader::onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, Color3B pColor3B, CCBReader * pCCBReader) {
void LabelBMFontLoader::onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, Color3B pColor3B, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_COLOR) == 0) {
((LabelBMFont *)pNode)->setColor(pColor3B);
} else {
NodeLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pColor3B, pCCBReader);
NodeLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pColor3B, ccbReader);
}
}
void LabelBMFontLoader::onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
void LabelBMFontLoader::onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_OPACITY) == 0) {
((LabelBMFont *)pNode)->setOpacity(pByte);
} else {
NodeLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, pCCBReader);
NodeLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, ccbReader);
}
}
void LabelBMFontLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, BlendFunc pBlendFunc, CCBReader * pCCBReader) {
void LabelBMFontLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, BlendFunc pBlendFunc, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
((LabelBMFont *)pNode)->setBlendFunc(pBlendFunc);
} else {
NodeLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pBlendFunc, pCCBReader);
NodeLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pBlendFunc, ccbReader);
}
}
void LabelBMFontLoader::onHandlePropTypeFntFile(Node * pNode, Node * pParent, const char * pPropertyName, const char* pFntFile, CCBReader * pCCBReader) {
void LabelBMFontLoader::onHandlePropTypeFntFile(Node * pNode, Node * pParent, const char * pPropertyName, const char* pFntFile, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_FNTFILE) == 0) {
((LabelBMFont *)pNode)->setFntFile(pFntFile);
} else {
NodeLoader::onHandlePropTypeFntFile(pNode, pParent, pPropertyName, pFntFile, pCCBReader);
NodeLoader::onHandlePropTypeFntFile(pNode, pParent, pPropertyName, pFntFile, ccbReader);
}
}
void LabelBMFontLoader::onHandlePropTypeText(Node * pNode, Node * pParent, const char * pPropertyName, const char* pText, CCBReader * pCCBReader) {
void LabelBMFontLoader::onHandlePropTypeText(Node * pNode, Node * pParent, const char * pPropertyName, const char* pText, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_STRING) == 0) {
((LabelBMFont *)pNode)->setString(pText);
} else {
NodeLoader::onHandlePropTypeText(pNode, pParent, pPropertyName, pText, pCCBReader);
NodeLoader::onHandlePropTypeText(pNode, pParent, pPropertyName, pText, ccbReader);
}
}

View File

@ -16,11 +16,11 @@ class LabelBMFontLoader : public NodeLoader {
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(LabelBMFont);
virtual void onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, Color3B pColor3B, CCBReader * pCCBReader);
virtual void onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, BlendFunc pBlendFunc, CCBReader * pCCBReader);
virtual void onHandlePropTypeFntFile(Node * pNode, Node * pParent, const char * pPropertyName, const char* pFntFile, CCBReader * pCCBReader);
virtual void onHandlePropTypeText(Node * pNode, Node * pParent, const char * pPropertyName, const char* pText, CCBReader * pCCBReader);
virtual void onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, Color3B pColor3B, CCBReader * ccbReader);
virtual void onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * ccbReader);
virtual void onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, BlendFunc pBlendFunc, CCBReader * ccbReader);
virtual void onHandlePropTypeFntFile(Node * pNode, Node * pParent, const char * pPropertyName, const char* pFntFile, CCBReader * ccbReader);
virtual void onHandlePropTypeText(Node * pNode, Node * pParent, const char * pPropertyName, const char* pText, CCBReader * ccbReader);
};
NS_CC_EXT_END

View File

@ -14,69 +14,69 @@
NS_CC_EXT_BEGIN
void LabelTTFLoader::onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, Color3B pColor3B, CCBReader * pCCBReader) {
void LabelTTFLoader::onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, Color3B pColor3B, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_COLOR) == 0) {
((LabelTTF *)pNode)->setColor(pColor3B);
} else {
NodeLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pColor3B, pCCBReader);
NodeLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pColor3B, ccbReader);
}
}
void LabelTTFLoader::onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
void LabelTTFLoader::onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_OPACITY) == 0) {
((LabelTTF *)pNode)->setOpacity(pByte);
} else {
NodeLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, pCCBReader);
NodeLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, ccbReader);
}
}
void LabelTTFLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, BlendFunc pBlendFunc, CCBReader * pCCBReader) {
void LabelTTFLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, BlendFunc pBlendFunc, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
((LabelTTF *)pNode)->setBlendFunc(pBlendFunc);
} else {
NodeLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pBlendFunc, pCCBReader);
NodeLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pBlendFunc, ccbReader);
}
}
void LabelTTFLoader::onHandlePropTypeFontTTF(Node * pNode, Node * pParent, const char * pPropertyName, const char * pFontTTF, CCBReader * pCCBReader) {
void LabelTTFLoader::onHandlePropTypeFontTTF(Node * pNode, Node * pParent, const char * pPropertyName, const char * pFontTTF, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_FONTNAME) == 0) {
((LabelTTF *)pNode)->setFontName(pFontTTF);
} else {
NodeLoader::onHandlePropTypeFontTTF(pNode, pParent, pPropertyName, pFontTTF, pCCBReader);
NodeLoader::onHandlePropTypeFontTTF(pNode, pParent, pPropertyName, pFontTTF, ccbReader);
}
}
void LabelTTFLoader::onHandlePropTypeText(Node * pNode, Node * pParent, const char * pPropertyName, const char * pText, CCBReader * pCCBReader) {
void LabelTTFLoader::onHandlePropTypeText(Node * pNode, Node * pParent, const char * pPropertyName, const char * pText, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_STRING) == 0) {
((LabelTTF *)pNode)->setString(pText);
} else {
NodeLoader::onHandlePropTypeText(pNode, pParent, pPropertyName, pText, pCCBReader);
NodeLoader::onHandlePropTypeText(pNode, pParent, pPropertyName, pText, ccbReader);
}
}
void LabelTTFLoader::onHandlePropTypeFloatScale(Node * pNode, Node * pParent, const char * pPropertyName, float pFloatScale, CCBReader * pCCBReader) {
void LabelTTFLoader::onHandlePropTypeFloatScale(Node * pNode, Node * pParent, const char * pPropertyName, float pFloatScale, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_FONTSIZE) == 0) {
((LabelTTF *)pNode)->setFontSize(pFloatScale);
} else {
NodeLoader::onHandlePropTypeFloatScale(pNode, pParent, pPropertyName, pFloatScale, pCCBReader);
NodeLoader::onHandlePropTypeFloatScale(pNode, pParent, pPropertyName, pFloatScale, ccbReader);
}
}
void LabelTTFLoader::onHandlePropTypeIntegerLabeled(Node * pNode, Node * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader) {
void LabelTTFLoader::onHandlePropTypeIntegerLabeled(Node * pNode, Node * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_HORIZONTALALIGNMENT) == 0) {
((LabelTTF *)pNode)->setHorizontalAlignment(Label::HAlignment(pIntegerLabeled));
} else if(strcmp(pPropertyName, PROPERTY_VERTICALALIGNMENT) == 0) {
((LabelTTF *)pNode)->setVerticalAlignment(Label::VAlignment(pIntegerLabeled));
} else {
NodeLoader::onHandlePropTypeFloatScale(pNode, pParent, pPropertyName, pIntegerLabeled, pCCBReader);
NodeLoader::onHandlePropTypeFloatScale(pNode, pParent, pPropertyName, pIntegerLabeled, ccbReader);
}
}
void LabelTTFLoader::onHandlePropTypeSize(Node * pNode, Node * pParent, const char * pPropertyName, Size pSize, CCBReader * pCCBReader) {
void LabelTTFLoader::onHandlePropTypeSize(Node * pNode, Node * pParent, const char * pPropertyName, Size pSize, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_DIMENSIONS) == 0) {
((LabelTTF *)pNode)->setDimensions(pSize);
} else {
NodeLoader::onHandlePropTypeSize(pNode, pParent, pPropertyName, pSize, pCCBReader);
NodeLoader::onHandlePropTypeSize(pNode, pParent, pPropertyName, pSize, ccbReader);
}
}

View File

@ -16,14 +16,14 @@ class LabelTTFLoader : public NodeLoader {
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(LabelTTF);
virtual void onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, Color3B pColor3B, CCBReader * pCCBReader);
virtual void onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, BlendFunc pBlendFunc, CCBReader * pCCBReader);
virtual void onHandlePropTypeFontTTF(Node * pNode, Node * pParent, const char * pPropertyName, const char * pFontTTF, CCBReader * pCCBReader);
virtual void onHandlePropTypeText(Node * pNode, Node * pParent, const char * pPropertyName, const char * pText, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloatScale(Node * pNode, Node * pParent, const char * pPropertyName, float pFloatScale, CCBReader * pCCBReader);
virtual void onHandlePropTypeIntegerLabeled(Node * pNode, Node * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader);
virtual void onHandlePropTypeSize(Node * pNode, Node * pParent, const char * pPropertyName, Size pSize, CCBReader * pCCBReader);
virtual void onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, Color3B pColor3B, CCBReader * ccbReader);
virtual void onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * ccbReader);
virtual void onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, BlendFunc pBlendFunc, CCBReader * ccbReader);
virtual void onHandlePropTypeFontTTF(Node * pNode, Node * pParent, const char * pPropertyName, const char * pFontTTF, CCBReader * ccbReader);
virtual void onHandlePropTypeText(Node * pNode, Node * pParent, const char * pPropertyName, const char * pText, CCBReader * ccbReader);
virtual void onHandlePropTypeFloatScale(Node * pNode, Node * pParent, const char * pPropertyName, float pFloatScale, CCBReader * ccbReader);
virtual void onHandlePropTypeIntegerLabeled(Node * pNode, Node * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * ccbReader);
virtual void onHandlePropTypeSize(Node * pNode, Node * pParent, const char * pPropertyName, Size pSize, CCBReader * ccbReader);
};
NS_CC_EXT_END

View File

@ -8,27 +8,27 @@ NS_CC_EXT_BEGIN
#define PROPERTY_OPACITY "opacity"
#define PROPERTY_BLENDFUNC "blendFunc"
void LayerColorLoader::onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, Color3B pColor3B, CCBReader * pCCBReader) {
void LayerColorLoader::onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, Color3B pColor3B, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_COLOR) == 0) {
((LayerColor *)pNode)->setColor(pColor3B);
} else {
LayerLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pColor3B, pCCBReader);
LayerLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pColor3B, ccbReader);
}
}
void LayerColorLoader::onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
void LayerColorLoader::onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_OPACITY) == 0) {
((LayerColor *)pNode)->setOpacity(pByte);
} else {
LayerLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, pCCBReader);
LayerLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, ccbReader);
}
}
void LayerColorLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, BlendFunc pBlendFunc, CCBReader * pCCBReader) {
void LayerColorLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, BlendFunc pBlendFunc, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
((LayerColor *)pNode)->setBlendFunc(pBlendFunc);
} else {
LayerLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pBlendFunc, pCCBReader);
LayerLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pBlendFunc, ccbReader);
}
}

View File

@ -16,9 +16,9 @@ class LayerColorLoader : public LayerLoader {
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(LayerColor);
virtual void onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, Color3B pColor3B, CCBReader * pCCBReader);
virtual void onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, BlendFunc pBlendFunc, CCBReader * pCCBReader);
virtual void onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, Color3B pColor3B, CCBReader * ccbReader);
virtual void onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * ccbReader);
virtual void onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, BlendFunc pBlendFunc, CCBReader * ccbReader);
};
NS_CC_EXT_END

View File

@ -11,43 +11,43 @@
NS_CC_EXT_BEGIN
void LayerGradientLoader::onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, Color3B pColor3B, CCBReader * pCCBReader) {
void LayerGradientLoader::onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, Color3B pColor3B, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_STARTCOLOR) == 0) {
((LayerGradient *)pNode)->setStartColor(pColor3B);
} else if(strcmp(pPropertyName, PROPERTY_ENDCOLOR) == 0) {
((LayerGradient *)pNode)->setEndColor(pColor3B);
} else {
LayerLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pColor3B, pCCBReader);
LayerLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pColor3B, ccbReader);
}
}
void LayerGradientLoader::onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
void LayerGradientLoader::onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_STARTOPACITY) == 0) {
((LayerGradient *)pNode)->setStartOpacity(pByte);
} else if(strcmp(pPropertyName, PROPERTY_ENDOPACITY) == 0) {
((LayerGradient *)pNode)->setEndOpacity(pByte);
} else {
LayerLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, pCCBReader);
LayerLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, ccbReader);
}
}
void LayerGradientLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, BlendFunc pBlendFunc, CCBReader * pCCBReader) {
void LayerGradientLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, BlendFunc pBlendFunc, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
((LayerGradient *)pNode)->setBlendFunc(pBlendFunc);
} else {
LayerLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pBlendFunc, pCCBReader);
LayerLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pBlendFunc, ccbReader);
}
}
void LayerGradientLoader::onHandlePropTypePoint(Node * pNode, Node * pParent, const char * pPropertyName, Point pPoint, CCBReader * pCCBReader) {
void LayerGradientLoader::onHandlePropTypePoint(Node * pNode, Node * pParent, const char * pPropertyName, Point pPoint, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_VECTOR) == 0) {
((LayerGradient *)pNode)->setVector(pPoint);
// TODO Not passed along the ccbi file.
// ((LayerGradient *)pNode)->setCompressedInterpolation(true);
} else {
LayerLoader::onHandlePropTypePoint(pNode, pParent, pPropertyName, pPoint, pCCBReader);
LayerLoader::onHandlePropTypePoint(pNode, pParent, pPropertyName, pPoint, ccbReader);
}
}

View File

@ -16,10 +16,10 @@ class LayerGradientLoader : public LayerLoader {
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(LayerGradient);
virtual void onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, Color3B pColor3B, CCBReader * pCCBReader);
virtual void onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader);
virtual void onHandlePropTypePoint(Node * pNode, Node * pParent, const char * pPropertyName, Point pPoint, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, BlendFunc pBlendFunc, CCBReader * pCCBReader);
virtual void onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, Color3B pColor3B, CCBReader * ccbReader);
virtual void onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * ccbReader);
virtual void onHandlePropTypePoint(Node * pNode, Node * pParent, const char * pPropertyName, Point pPoint, CCBReader * ccbReader);
virtual void onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, BlendFunc pBlendFunc, CCBReader * ccbReader);
};
NS_CC_EXT_END

View File

@ -10,7 +10,7 @@
NS_CC_EXT_BEGIN
void LayerLoader::onHandlePropTypeCheck(Node * pNode, Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
void LayerLoader::onHandlePropTypeCheck(Node * pNode, Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_TOUCH_ENABLED) == 0) {
((Layer *)pNode)->setTouchEnabled(pCheck);
} else if(strcmp(pPropertyName, PROPERTY_ACCELEROMETER_ENABLED) == 0) {
@ -23,7 +23,7 @@ void LayerLoader::onHandlePropTypeCheck(Node * pNode, Node * pParent, const char
CCLOG("The property '%s' is not supported!", PROPERTY_KEYBOARD_ENABLED);
// This comes closest: ((Layer *)pNode)->setKeypadEnabled(pCheck);
} else {
NodeLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, pCCBReader);
NodeLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, ccbReader);
}
}

View File

@ -16,7 +16,7 @@ class LayerLoader : public NodeLoader {
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(Layer);
virtual void onHandlePropTypeCheck(Node * pNode, Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader);
virtual void onHandlePropTypeCheck(Node * pNode, Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * ccbReader);
};
NS_CC_EXT_END

View File

@ -8,7 +8,7 @@
NS_CC_EXT_BEGIN
void MenuItemImageLoader::onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, const char * pPropertyName, SpriteFrame * pSpriteFrame, CCBReader * pCCBReader) {
void MenuItemImageLoader::onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, const char * pPropertyName, SpriteFrame * pSpriteFrame, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_NORMALDISPLAYFRAME) == 0) {
if(pSpriteFrame != NULL) {
((MenuItemImage *)pNode)->setNormalSpriteFrame(pSpriteFrame);
@ -22,7 +22,7 @@ void MenuItemImageLoader::onHandlePropTypeSpriteFrame(Node * pNode, Node * pPare
((MenuItemImage *)pNode)->setDisabledSpriteFrame(pSpriteFrame);
}
} else {
MenuItemLoader::onHandlePropTypeSpriteFrame(pNode, pParent, pPropertyName, pSpriteFrame, pCCBReader);
MenuItemLoader::onHandlePropTypeSpriteFrame(pNode, pParent, pPropertyName, pSpriteFrame, ccbReader);
}
}

View File

@ -16,7 +16,7 @@ class MenuItemImageLoader : public MenuItemLoader {
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(MenuItemImage);
virtual void onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, const char * pPropertyName, SpriteFrame * pSpriteFrame, CCBReader * pCCBReader);
virtual void onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, const char * pPropertyName, SpriteFrame * pSpriteFrame, CCBReader * ccbReader);
};
NS_CC_EXT_END

View File

@ -7,23 +7,23 @@
NS_CC_EXT_BEGIN
void MenuItemLoader::onHandlePropTypeBlock(Node * pNode, Node * pParent, const char * pPropertyName, BlockData * pBlockData, CCBReader * pCCBReader) {
void MenuItemLoader::onHandlePropTypeBlock(Node * pNode, Node * pParent, const char * pPropertyName, BlockData * pBlockData, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_BLOCK) == 0) {
if (NULL != pBlockData) // Add this condition to allow MenuItemImage without target/selector predefined
{
((MenuItem *)pNode)->setCallback( std::bind( pBlockData->mSELMenuHandler, pBlockData->mTarget, std::placeholders::_1) );
// ((MenuItem *)pNode)->setTarget(pBlockData->mTarget, pBlockData->mSELMenuHandler);
((MenuItem *)pNode)->setCallback( std::bind( pBlockData->mSELMenuHandler, pBlockData->_target, std::placeholders::_1) );
// ((MenuItem *)pNode)->setTarget(pBlockData->_target, pBlockData->mSELMenuHandler);
}
} else {
NodeLoader::onHandlePropTypeBlock(pNode, pParent, pPropertyName, pBlockData, pCCBReader);
NodeLoader::onHandlePropTypeBlock(pNode, pParent, pPropertyName, pBlockData, ccbReader);
}
}
void MenuItemLoader::onHandlePropTypeCheck(Node * pNode, Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
void MenuItemLoader::onHandlePropTypeCheck(Node * pNode, Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_ISENABLED) == 0) {
((MenuItem *)pNode)->setEnabled(pCheck);
} else {
NodeLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, pCCBReader);
NodeLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, ccbReader);
}
}

View File

@ -15,8 +15,8 @@ class MenuItemLoader : public NodeLoader {
protected:
CCB_PURE_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(MenuItem);
virtual void onHandlePropTypeBlock(Node * pNode, Node * pParent, const char * pPropertyName, BlockData * pBlockData, CCBReader * pCCBReader);
virtual void onHandlePropTypeCheck(Node * pNode, Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlock(Node * pNode, Node * pParent, const char * pPropertyName, BlockData * pBlockData, CCBReader * ccbReader);
virtual void onHandlePropTypeCheck(Node * pNode, Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * ccbReader);
};
NS_CC_EXT_END

View File

@ -1,38 +1,36 @@
#include "CCNode+CCBRelativePositioning.h"
#include "CCBReader.h"
using namespace cocos2d;
NS_CC_EXT_BEGIN
Point getAbsolutePosition(const Point &pt, int nType, const Size &containerSize, const char *pPropName)
Point getAbsolutePosition(const Point &pt, CCBReader::PositionType type, const Size &containerSize, const char *propName)
{
Point absPt = Point(0,0);
if (nType == kCCBPositionTypeRelativeBottomLeft)
if (type == CCBReader::PositionType::RELATIVE_BOTTOM_LEFT)
{
absPt = pt;
}
else if (nType == kCCBPositionTypeRelativeTopLeft)
else if (type == CCBReader::PositionType::RELATIVE_TOP_LEFT)
{
absPt.x = pt.x;
absPt.y = containerSize.height - pt.y;
}
else if (nType == kCCBPositionTypeRelativeTopRight)
else if (type == CCBReader::PositionType::RELATIVE_TOP_RIGHT)
{
absPt.x = containerSize.width - pt.x;
absPt.y = containerSize.height - pt.y;
}
else if (nType == kCCBPositionTypeRelativeBottomRight)
else if (type == CCBReader::PositionType::RELATIVE_BOTTOM_RIGHT)
{
absPt.x = containerSize.width - pt.x;
absPt.y = pt.y;
}
else if (nType == kCCBPositionTypePercent)
else if (type == CCBReader::PositionType::PERCENT)
{
absPt.x = (int)(containerSize.width * pt.x / 100.0f);
absPt.y = (int)(containerSize.height * pt.y / 100.0f);
}
else if (nType == kCCBPositionTypeMultiplyResolution)
else if (type == CCBReader::PositionType::MULTIPLY_RESOLUTION)
{
float resolutionScale = CCBReader::getResolutionScale();
@ -43,20 +41,20 @@ Point getAbsolutePosition(const Point &pt, int nType, const Size &containerSize,
return absPt;
}
void setRelativeScale(Node *pNode, float fScaleX, float fScaleY, int nType, const char* pPropName)
void setRelativeScale(Node *pNode, float scaleX, float scaleY, CCBReader::ScaleType type, const char* propName)
{
CCASSERT(pNode, "pNode should not be null");
if (nType == kCCBScaleTypeMultiplyResolution)
if (type == CCBReader::ScaleType::MULTIPLY_RESOLUTION)
{
float resolutionScale = CCBReader::getResolutionScale();
fScaleX *= resolutionScale;
fScaleY *= resolutionScale;
scaleX *= resolutionScale;
scaleY *= resolutionScale;
}
pNode->setScaleX(fScaleX);
pNode->setScaleY(fScaleY);
pNode->setScaleX(scaleX);
pNode->setScaleY(scaleY);
}
NS_CC_EXT_END

View File

@ -3,12 +3,13 @@
#include "cocos2d.h"
#include "ExtensionMacros.h"
#include "CCBReader.h"
NS_CC_EXT_BEGIN
extern Point getAbsolutePosition(const Point &pt, int nType, const Size &containerSize, const char *pPropName);
extern Point getAbsolutePosition(const Point &pt, CCBReader::PositionType type, const Size &containerSize, const char *propName);
extern void setRelativeScale(Node *pNode, float fScaleX, float fScaleY, int nType, const char* pPropName);
extern void setRelativeScale(Node *node, float scaleX, float scaleY, CCBReader::ScaleType type, const char* propName);
NS_CC_EXT_END

File diff suppressed because it is too large Load Diff

View File

@ -24,20 +24,20 @@ NS_CC_EXT_BEGIN
#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)
#define CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(T) virtual T * createNode(cocos2d::Node * pParent, cocos2d::extension::CCBReader * pCCBReader) { \
#define CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(T) virtual T * createNode(cocos2d::Node * pParent, cocos2d::extension::CCBReader * ccbReader) { \
return T::create(); \
}
#define CCB_PURE_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(T) virtual T * createNode(cocos2d::Node * pParent, cocos2d::extension::CCBReader * pCCBReader) = 0
#define CCB_PURE_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(T) virtual T * createNode(cocos2d::Node * pParent, cocos2d::extension::CCBReader * ccbReader) = 0
struct BlockData {
SEL_MenuHandler mSELMenuHandler;
Object * mTarget;
Object * _target;
};
struct BlockControlData {
Control::Handler mSELControlHandler;
Object * mTarget;
Object * _target;
Control::EventType mControlEvents;
};
@ -50,72 +50,72 @@ class NodeLoader : public Object {
virtual ~NodeLoader();
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(NodeLoader, loader);
virtual Node * loadNode(Node *, CCBReader * pCCBReader);
virtual void parseProperties(Node * pNode, Node * pParent, CCBReader * pCCBReader);
virtual Node * loadNode(Node *, CCBReader * ccbReader);
virtual void parseProperties(Node * pNode, Node * pParent, CCBReader * ccbReader);
virtual Dictionary* getCustomProperties();
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(Node);
virtual Point parsePropTypePosition(Node * pNode, Node * pParent, CCBReader * pCCBReader, const char *pPropertyName);
virtual Point parsePropTypePoint(Node * pNode, Node * pParent, CCBReader * pCCBReader);
virtual Point parsePropTypePointLock(Node * pNode, Node * pParent, CCBReader * pCCBReader);
virtual Size parsePropTypeSize(Node * pNode, Node * pParent, CCBReader * pCCBReader);
virtual float * parsePropTypeScaleLock(Node * pNode, Node * pParent, CCBReader * pCCBReader, const char *pPropertyName);
virtual float parsePropTypeFloat(Node * pNode, Node * pParent, CCBReader * pCCBReader);
virtual float parsePropTypeDegrees(Node * pNode, Node * pParent, CCBReader * pCCBReader, const char *pPropertyName);
virtual float parsePropTypeFloatScale(Node * pNode, Node * pParent, CCBReader * pCCBReader);
virtual int parsePropTypeInteger(Node * pNode, Node * pParent, CCBReader * pCCBReader);
virtual int parsePropTypeIntegerLabeled(Node * pNode, Node * pParent, CCBReader * pCCBReader);
virtual float * parsePropTypeFloatVar(Node * pNode, Node * pParent, CCBReader * pCCBReader);
virtual bool parsePropTypeCheck(Node * pNode, Node * pParent, CCBReader * pCCBReader, const char *pPropertyName);
virtual SpriteFrame * parsePropTypeSpriteFrame(Node * pNode, Node * pParent, CCBReader * pCCBReader, const char *pPropertyName);
virtual Animation * parsePropTypeAnimation(Node * pNode, Node * pParent, CCBReader * pCCBReader);
virtual Texture2D * parsePropTypeTexture(Node * pNode, Node * pParent, CCBReader * pCCBReader);
virtual unsigned char parsePropTypeByte(Node * pNode, Node * pParent, CCBReader * pCCBReader, const char *pPropertyName);
virtual Color3B parsePropTypeColor3(Node * pNode, Node * pParent, CCBReader * pCCBReader, const char *pPropertyName);
virtual Color4F * parsePropTypeColor4FVar(Node * pNode, Node * pParent, CCBReader * pCCBReader);
virtual bool * parsePropTypeFlip(Node * pNode, Node * pParent, CCBReader * pCCBReader);
virtual BlendFunc parsePropTypeBlendFunc(Node * pNode, Node * pParent, CCBReader * pCCBReader);
virtual std::string parsePropTypeFntFile(Node * pNode, Node * pParent, CCBReader * pCCBReader);
virtual std::string parsePropTypeString(Node * pNode, Node * pParent, CCBReader * pCCBReader);
virtual std::string parsePropTypeText(Node * pNode, Node * pParent, CCBReader * pCCBReader);
virtual std::string parsePropTypeFontTTF(Node * pNode, Node * pParent, CCBReader * pCCBReader);
virtual BlockData * parsePropTypeBlock(Node * pNode, Node * pParent, CCBReader * pCCBReader);
virtual BlockControlData * parsePropTypeBlockControl(Node * pNode, Node * pParent, CCBReader * pCCBReader);
virtual Node * parsePropTypeCCBFile(Node * pNode, Node * pParent, CCBReader * pCCBReader);
virtual float * parsePropTypeFloatXY(Node * pNode, Node * pParent, CCBReader * pCCBReader);
virtual Point parsePropTypePosition(Node * pNode, Node * pParent, CCBReader * ccbReader, const char *pPropertyName);
virtual Point parsePropTypePoint(Node * pNode, Node * pParent, CCBReader * ccbReader);
virtual Point parsePropTypePointLock(Node * pNode, Node * pParent, CCBReader * ccbReader);
virtual Size parsePropTypeSize(Node * pNode, Node * pParent, CCBReader * ccbReader);
virtual float * parsePropTypeScaleLock(Node * pNode, Node * pParent, CCBReader * ccbReader, const char *pPropertyName);
virtual float parsePropTypeFloat(Node * pNode, Node * pParent, CCBReader * ccbReader);
virtual float parsePropTypeDegrees(Node * pNode, Node * pParent, CCBReader * ccbReader, const char *pPropertyName);
virtual float parsePropTypeFloatScale(Node * pNode, Node * pParent, CCBReader * ccbReader);
virtual int parsePropTypeInteger(Node * pNode, Node * pParent, CCBReader * ccbReader);
virtual int parsePropTypeIntegerLabeled(Node * pNode, Node * pParent, CCBReader * ccbReader);
virtual float * parsePropTypeFloatVar(Node * pNode, Node * pParent, CCBReader * ccbReader);
virtual bool parsePropTypeCheck(Node * pNode, Node * pParent, CCBReader * ccbReader, const char *pPropertyName);
virtual SpriteFrame * parsePropTypeSpriteFrame(Node * pNode, Node * pParent, CCBReader * ccbReader, const char *pPropertyName);
virtual Animation * parsePropTypeAnimation(Node * pNode, Node * pParent, CCBReader * ccbReader);
virtual Texture2D * parsePropTypeTexture(Node * pNode, Node * pParent, CCBReader * ccbReader);
virtual unsigned char parsePropTypeByte(Node * pNode, Node * pParent, CCBReader * ccbReader, const char *pPropertyName);
virtual Color3B parsePropTypeColor3(Node * pNode, Node * pParent, CCBReader * ccbReader, const char *pPropertyName);
virtual Color4F * parsePropTypeColor4FVar(Node * pNode, Node * pParent, CCBReader * ccbReader);
virtual bool * parsePropTypeFlip(Node * pNode, Node * pParent, CCBReader * ccbReader);
virtual BlendFunc parsePropTypeBlendFunc(Node * pNode, Node * pParent, CCBReader * ccbReader);
virtual std::string parsePropTypeFntFile(Node * pNode, Node * pParent, CCBReader * ccbReader);
virtual std::string parsePropTypeString(Node * pNode, Node * pParent, CCBReader * ccbReader);
virtual std::string parsePropTypeText(Node * pNode, Node * pParent, CCBReader * ccbReader);
virtual std::string parsePropTypeFontTTF(Node * pNode, Node * pParent, CCBReader * ccbReader);
virtual BlockData * parsePropTypeBlock(Node * pNode, Node * pParent, CCBReader * ccbReader);
virtual BlockControlData * parsePropTypeBlockControl(Node * pNode, Node * pParent, CCBReader * ccbReader);
virtual Node * parsePropTypeCCBFile(Node * pNode, Node * pParent, CCBReader * ccbReader);
virtual float * parsePropTypeFloatXY(Node * pNode, Node * pParent, CCBReader * ccbReader);
virtual void onHandlePropTypePosition(Node * pNode, Node * pParent, const char* pPropertyName, Point pPosition, CCBReader * pCCBReader);
virtual void onHandlePropTypePoint(Node * pNode, Node * pParent, const char* pPropertyName, Point pPoint, CCBReader * pCCBReader);
virtual void onHandlePropTypePointLock(Node * pNode, Node * pParent, const char* pPropertyName, Point pPointLock, CCBReader * pCCBReader);
virtual void onHandlePropTypeSize(Node * pNode, Node * pParent, const char* pPropertyName, Size pSize, CCBReader * pCCBReader);
virtual void onHandlePropTypeScaleLock(Node * pNode, Node * pParent, const char* pPropertyName, float * pScaleLock, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloat(Node * pNode, Node * pParent, const char* pPropertyName, float pFloat, CCBReader * pCCBReader);
virtual void onHandlePropTypeDegrees(Node * pNode, Node * pParent, const char* pPropertyName, float pDegrees, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloatScale(Node * pNode, Node * pParent, const char* pPropertyName, float pFloatScale, CCBReader * pCCBReader);
virtual void onHandlePropTypeInteger(Node * pNode, Node * pParent, const char* pPropertyName, int pInteger, CCBReader * pCCBReader);
virtual void onHandlePropTypeIntegerLabeled(Node * pNode, Node * pParent, const char* pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloatVar(Node * pNode, Node * pParent, const char* pPropertyName, float * pFoatVar, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloatXY(Node * pNode, Node * pParent, const char* pPropertyName, float * pFoatVar, CCBReader * pCCBReader);
virtual void onHandlePropTypePosition(Node * pNode, Node * pParent, const char* pPropertyName, Point pPosition, CCBReader * ccbReader);
virtual void onHandlePropTypePoint(Node * pNode, Node * pParent, const char* pPropertyName, Point pPoint, CCBReader * ccbReader);
virtual void onHandlePropTypePointLock(Node * pNode, Node * pParent, const char* pPropertyName, Point pPointLock, CCBReader * ccbReader);
virtual void onHandlePropTypeSize(Node * pNode, Node * pParent, const char* pPropertyName, Size pSize, CCBReader * ccbReader);
virtual void onHandlePropTypeScaleLock(Node * pNode, Node * pParent, const char* pPropertyName, float * pScaleLock, CCBReader * ccbReader);
virtual void onHandlePropTypeFloat(Node * pNode, Node * pParent, const char* pPropertyName, float pFloat, CCBReader * ccbReader);
virtual void onHandlePropTypeDegrees(Node * pNode, Node * pParent, const char* pPropertyName, float pDegrees, CCBReader * ccbReader);
virtual void onHandlePropTypeFloatScale(Node * pNode, Node * pParent, const char* pPropertyName, float pFloatScale, CCBReader * ccbReader);
virtual void onHandlePropTypeInteger(Node * pNode, Node * pParent, const char* pPropertyName, int pInteger, CCBReader * ccbReader);
virtual void onHandlePropTypeIntegerLabeled(Node * pNode, Node * pParent, const char* pPropertyName, int pIntegerLabeled, CCBReader * ccbReader);
virtual void onHandlePropTypeFloatVar(Node * pNode, Node * pParent, const char* pPropertyName, float * pFoatVar, CCBReader * ccbReader);
virtual void onHandlePropTypeFloatXY(Node * pNode, Node * pParent, const char* pPropertyName, float * pFoatVar, CCBReader * ccbReader);
virtual void onHandlePropTypeCheck(Node * pNode, Node * pParent, const char* pPropertyName, bool pCheck, CCBReader * pCCBReader);
virtual void onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, const char* pPropertyName, SpriteFrame * pSpriteFrame, CCBReader * pCCBReader);
virtual void onHandlePropTypeAnimation(Node * pNode, Node * pParent, const char* pPropertyName, Animation * pAnimation, CCBReader * pCCBReader);
virtual void onHandlePropTypeTexture(Node * pNode, Node * pParent, const char* pPropertyName, Texture2D * pTexture2D, CCBReader * pCCBReader);
virtual void onHandlePropTypeByte(Node * pNode, Node * pParent, const char* pPropertyName, unsigned char pByte, CCBReader * pCCBReader);
virtual void onHandlePropTypeColor3(Node * pNode, Node * pParent, const char* pPropertyName, Color3B pColor3B, CCBReader * pCCBReader);
virtual void onHandlePropTypeColor4FVar(Node * pNode, Node * pParent, const char* pPropertyName, Color4F * pColor4FVar, CCBReader * pCCBReader);
virtual void onHandlePropTypeFlip(Node * pNode, Node * pParent, const char* pPropertyName, bool * pFlip, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char* pPropertyName, BlendFunc pBlendFunc, CCBReader * pCCBReader);
virtual void onHandlePropTypeFntFile(Node * pNode, Node * pParent, const char* pPropertyName, const char * pFntFile, CCBReader * pCCBReader);
virtual void onHandlePropTypeString(Node * pNode, Node * pParent, const char* pPropertyName, const char * pString, CCBReader * pCCBReader);
virtual void onHandlePropTypeText(Node * pNode, Node * pParent, const char* pPropertyName, const char * pText, CCBReader * pCCBReader);
virtual void onHandlePropTypeFontTTF(Node * pNode, Node * pParent, const char* pPropertyName, const char * pFontTTF, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlock(Node * pNode, Node * pParent, const char* pPropertyName, BlockData * pBlockData, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlockControl(Node * pNode, Node * pParent, const char* pPropertyName, BlockControlData * pBlockControlData, CCBReader * pCCBReader);
virtual void onHandlePropTypeCCBFile(Node * pNode, Node * pParent, const char* pPropertyName, Node * pCCBFileNode, CCBReader * pCCBReader);
virtual void onHandlePropTypeCheck(Node * pNode, Node * pParent, const char* pPropertyName, bool pCheck, CCBReader * ccbReader);
virtual void onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, const char* pPropertyName, SpriteFrame * pSpriteFrame, CCBReader * ccbReader);
virtual void onHandlePropTypeAnimation(Node * pNode, Node * pParent, const char* pPropertyName, Animation * pAnimation, CCBReader * ccbReader);
virtual void onHandlePropTypeTexture(Node * pNode, Node * pParent, const char* pPropertyName, Texture2D * pTexture2D, CCBReader * ccbReader);
virtual void onHandlePropTypeByte(Node * pNode, Node * pParent, const char* pPropertyName, unsigned char pByte, CCBReader * ccbReader);
virtual void onHandlePropTypeColor3(Node * pNode, Node * pParent, const char* pPropertyName, Color3B pColor3B, CCBReader * ccbReader);
virtual void onHandlePropTypeColor4FVar(Node * pNode, Node * pParent, const char* pPropertyName, Color4F * pColor4FVar, CCBReader * ccbReader);
virtual void onHandlePropTypeFlip(Node * pNode, Node * pParent, const char* pPropertyName, bool * pFlip, CCBReader * ccbReader);
virtual void onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char* pPropertyName, BlendFunc pBlendFunc, CCBReader * ccbReader);
virtual void onHandlePropTypeFntFile(Node * pNode, Node * pParent, const char* pPropertyName, const char * pFntFile, CCBReader * ccbReader);
virtual void onHandlePropTypeString(Node * pNode, Node * pParent, const char* pPropertyName, const char * pString, CCBReader * ccbReader);
virtual void onHandlePropTypeText(Node * pNode, Node * pParent, const char* pPropertyName, const char * pText, CCBReader * ccbReader);
virtual void onHandlePropTypeFontTTF(Node * pNode, Node * pParent, const char* pPropertyName, const char * pFontTTF, CCBReader * ccbReader);
virtual void onHandlePropTypeBlock(Node * pNode, Node * pParent, const char* pPropertyName, BlockData * pBlockData, CCBReader * ccbReader);
virtual void onHandlePropTypeBlockControl(Node * pNode, Node * pParent, const char* pPropertyName, BlockControlData * pBlockControlData, CCBReader * ccbReader);
virtual void onHandlePropTypeCCBFile(Node * pNode, Node * pParent, const char* pPropertyName, Node * pCCBFileNode, CCBReader * ccbReader);
protected:
Dictionary* _customProperties;

View File

@ -27,43 +27,43 @@
NS_CC_EXT_BEGIN
void ParticleSystemQuadLoader::onHandlePropTypeIntegerLabeled(Node * pNode, Node * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader) {
void ParticleSystemQuadLoader::onHandlePropTypeIntegerLabeled(Node * pNode, Node * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_EMITERMODE) == 0) {
((ParticleSystemQuad *)pNode)->setEmitterMode((ParticleSystem::Mode)pIntegerLabeled);
} else {
NodeLoader::onHandlePropTypeIntegerLabeled(pNode, pParent, pPropertyName, pIntegerLabeled, pCCBReader);
NodeLoader::onHandlePropTypeIntegerLabeled(pNode, pParent, pPropertyName, pIntegerLabeled, ccbReader);
}
}
void ParticleSystemQuadLoader::onHandlePropTypePoint(Node * pNode, Node * pParent, const char * pPropertyName, Point pPoint, CCBReader * pCCBReader) {
void ParticleSystemQuadLoader::onHandlePropTypePoint(Node * pNode, Node * pParent, const char * pPropertyName, Point pPoint, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_POSVAR) == 0) {
((ParticleSystemQuad *)pNode)->setPosVar(pPoint);
} else if(strcmp(pPropertyName, PROPERTY_GRAVITY) == 0) {
((ParticleSystemQuad *)pNode)->setGravity(pPoint);
} else {
NodeLoader::onHandlePropTypePoint(pNode, pParent, pPropertyName, pPoint, pCCBReader);
NodeLoader::onHandlePropTypePoint(pNode, pParent, pPropertyName, pPoint, ccbReader);
}
}
void ParticleSystemQuadLoader::onHandlePropTypeFloat(Node * pNode, Node * pParent, const char * pPropertyName, float pFloat, CCBReader * pCCBReader) {
void ParticleSystemQuadLoader::onHandlePropTypeFloat(Node * pNode, Node * pParent, const char * pPropertyName, float pFloat, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_EMISSIONRATE) == 0) {
((ParticleSystemQuad *)pNode)->setEmissionRate(pFloat);
} else if(strcmp(pPropertyName, PROPERTY_DURATION) == 0) {
((ParticleSystemQuad *)pNode)->setDuration(pFloat);
} else {
NodeLoader::onHandlePropTypeFloat(pNode, pParent, pPropertyName, pFloat, pCCBReader);
NodeLoader::onHandlePropTypeFloat(pNode, pParent, pPropertyName, pFloat, ccbReader);
}
}
void ParticleSystemQuadLoader::onHandlePropTypeInteger(Node * pNode, Node * pParent, const char * pPropertyName, int pInteger, CCBReader * pCCBReader) {
void ParticleSystemQuadLoader::onHandlePropTypeInteger(Node * pNode, Node * pParent, const char * pPropertyName, int pInteger, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_TOTALPARTICLES) == 0) {
((ParticleSystemQuad *)pNode)->setTotalParticles(pInteger);
} else {
NodeLoader::onHandlePropTypeInteger(pNode, pParent, pPropertyName, pInteger, pCCBReader);
NodeLoader::onHandlePropTypeInteger(pNode, pParent, pPropertyName, pInteger, ccbReader);
}
}
void ParticleSystemQuadLoader::onHandlePropTypeFloatVar(Node * pNode, Node * pParent, const char * pPropertyName, float * pFloatVar, CCBReader * pCCBReader) {
void ParticleSystemQuadLoader::onHandlePropTypeFloatVar(Node * pNode, Node * pParent, const char * pPropertyName, float * pFloatVar, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_LIFE) == 0) {
((ParticleSystemQuad *)pNode)->setLife(pFloatVar[0]);
((ParticleSystemQuad *)pNode)->setLifeVar(pFloatVar[1]);
@ -101,11 +101,11 @@ void ParticleSystemQuadLoader::onHandlePropTypeFloatVar(Node * pNode, Node * pPa
((ParticleSystemQuad *)pNode)->setRotatePerSecond(pFloatVar[0]);
((ParticleSystemQuad *)pNode)->setRotatePerSecondVar(pFloatVar[1]);
} else {
NodeLoader::onHandlePropTypeFloatVar(pNode, pParent, pPropertyName, pFloatVar, pCCBReader);
NodeLoader::onHandlePropTypeFloatVar(pNode, pParent, pPropertyName, pFloatVar, ccbReader);
}
}
void ParticleSystemQuadLoader::onHandlePropTypeColor4FVar(Node * pNode, Node * pParent, const char * pPropertyName, Color4F * pColor4FVar, CCBReader * pCCBReader) {
void ParticleSystemQuadLoader::onHandlePropTypeColor4FVar(Node * pNode, Node * pParent, const char * pPropertyName, Color4F * pColor4FVar, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_STARTCOLOR) == 0) {
((ParticleSystemQuad *)pNode)->setStartColor(pColor4FVar[0]);
((ParticleSystemQuad *)pNode)->setStartColorVar(pColor4FVar[1]);
@ -113,23 +113,23 @@ void ParticleSystemQuadLoader::onHandlePropTypeColor4FVar(Node * pNode, Node * p
((ParticleSystemQuad *)pNode)->setEndColor(pColor4FVar[0]);
((ParticleSystemQuad *)pNode)->setEndColorVar(pColor4FVar[1]);
} else {
NodeLoader::onHandlePropTypeColor4FVar(pNode, pParent, pPropertyName, pColor4FVar, pCCBReader);
NodeLoader::onHandlePropTypeColor4FVar(pNode, pParent, pPropertyName, pColor4FVar, ccbReader);
}
}
void ParticleSystemQuadLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, BlendFunc pBlendFunc, CCBReader * pCCBReader) {
void ParticleSystemQuadLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, BlendFunc pBlendFunc, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
((ParticleSystemQuad *)pNode)->setBlendFunc(pBlendFunc);
} else {
NodeLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pBlendFunc, pCCBReader);
NodeLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pBlendFunc, ccbReader);
}
}
void ParticleSystemQuadLoader::onHandlePropTypeTexture(Node * pNode, Node * pParent, const char * pPropertyName, Texture2D * pTexture2D, CCBReader * pCCBReader) {
void ParticleSystemQuadLoader::onHandlePropTypeTexture(Node * pNode, Node * pParent, const char * pPropertyName, Texture2D * pTexture2D, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_TEXTURE) == 0) {
((ParticleSystemQuad *)pNode)->setTexture(pTexture2D);
} else {
NodeLoader::onHandlePropTypeTexture(pNode, pParent, pPropertyName, pTexture2D, pCCBReader);
NodeLoader::onHandlePropTypeTexture(pNode, pParent, pPropertyName, pTexture2D, ccbReader);
}
}

View File

@ -16,14 +16,14 @@ class ParticleSystemQuadLoader : public NodeLoader {
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(ParticleSystemQuad);
virtual void onHandlePropTypeIntegerLabeled(Node * pNode, Node * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader);
virtual void onHandlePropTypePoint(Node * pNode, Node * pParent, const char * pPropertyName, Point pPoint, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloat(Node * pNode, Node * pParent, const char * pPropertyName, float pFloat, CCBReader * pCCBReader);
virtual void onHandlePropTypeInteger(Node * pNode, Node * pParent, const char * pPropertyName, int pInteger, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloatVar(Node * pNode, Node * pParent, const char * pPropertyName, float * pFloatVar, CCBReader * pCCBReader);
virtual void onHandlePropTypeColor4FVar(Node * pNode, Node * pParent, const char * pPropertyName, Color4F * pColor4FVar, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, BlendFunc pBlendFunc, CCBReader * pCCBReader);
virtual void onHandlePropTypeTexture(Node * pNode, Node * pParent, const char * pPropertyName, Texture2D * pTexture2D, CCBReader * pCCBReader);
virtual void onHandlePropTypeIntegerLabeled(Node * pNode, Node * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * ccbReader);
virtual void onHandlePropTypePoint(Node * pNode, Node * pParent, const char * pPropertyName, Point pPoint, CCBReader * ccbReader);
virtual void onHandlePropTypeFloat(Node * pNode, Node * pParent, const char * pPropertyName, float pFloat, CCBReader * ccbReader);
virtual void onHandlePropTypeInteger(Node * pNode, Node * pParent, const char * pPropertyName, int pInteger, CCBReader * ccbReader);
virtual void onHandlePropTypeFloatVar(Node * pNode, Node * pParent, const char * pPropertyName, float * pFloatVar, CCBReader * ccbReader);
virtual void onHandlePropTypeColor4FVar(Node * pNode, Node * pParent, const char * pPropertyName, Color4F * pColor4FVar, CCBReader * ccbReader);
virtual void onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, BlendFunc pBlendFunc, CCBReader * ccbReader);
virtual void onHandlePropTypeTexture(Node * pNode, Node * pParent, const char * pPropertyName, Texture2D * pTexture2D, CCBReader * ccbReader);
};
NS_CC_EXT_END

View File

@ -15,50 +15,50 @@
NS_CC_EXT_BEGIN
void Scale9SpriteLoader::onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, const char * pPropertyName, SpriteFrame * pSpriteFrame, CCBReader * pCCBReader) {
void Scale9SpriteLoader::onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, const char * pPropertyName, SpriteFrame * pSpriteFrame, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_SPRITEFRAME) == 0) {
((Scale9Sprite *)pNode)->setSpriteFrame(pSpriteFrame);
} else {
NodeLoader::onHandlePropTypeSpriteFrame(pNode, pParent, pPropertyName, pSpriteFrame, pCCBReader);
NodeLoader::onHandlePropTypeSpriteFrame(pNode, pParent, pPropertyName, pSpriteFrame, ccbReader);
}
}
void Scale9SpriteLoader::onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, Color3B pColor3B, CCBReader * pCCBReader) {
void Scale9SpriteLoader::onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, Color3B pColor3B, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_COLOR) == 0) {
((Scale9Sprite *)pNode)->setColor(pColor3B);
} else {
NodeLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pColor3B, pCCBReader);
NodeLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pColor3B, ccbReader);
}
}
void Scale9SpriteLoader::onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
void Scale9SpriteLoader::onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_OPACITY) == 0) {
((Scale9Sprite *)pNode)->setOpacity(pByte);
} else {
NodeLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, pCCBReader);
NodeLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, ccbReader);
}
}
void Scale9SpriteLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, BlendFunc pBlendFunc, CCBReader * pCCBReader) {
void Scale9SpriteLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, BlendFunc pBlendFunc, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
// TODO Not exported by CocosBuilder yet!
// ((Scale9Sprite *)pNode)->setBlendFunc(pBlendFunc);
} else {
NodeLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pBlendFunc, pCCBReader);
NodeLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pBlendFunc, ccbReader);
}
}
void Scale9SpriteLoader::onHandlePropTypeSize(Node * pNode, Node * pParent, const char * pPropertyName, Size pSize, CCBReader * pCCBReader) {
void Scale9SpriteLoader::onHandlePropTypeSize(Node * pNode, Node * pParent, const char * pPropertyName, Size pSize, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_CONTENTSIZE) == 0) {
//((Scale9Sprite *)pNode)->setContentSize(pSize);
} else if(strcmp(pPropertyName, PROPERTY_PREFEREDSIZE) == 0) {
((Scale9Sprite *)pNode)->setPreferredSize(pSize);
} else {
NodeLoader::onHandlePropTypeSize(pNode, pParent, pPropertyName, pSize, pCCBReader);
NodeLoader::onHandlePropTypeSize(pNode, pParent, pPropertyName, pSize, ccbReader);
}
}
void Scale9SpriteLoader::onHandlePropTypeFloat(Node * pNode, Node * pParent, const char * pPropertyName, float pFloat, CCBReader * pCCBReader) {
void Scale9SpriteLoader::onHandlePropTypeFloat(Node * pNode, Node * pParent, const char * pPropertyName, float pFloat, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_INSETLEFT) == 0) {
((Scale9Sprite *)pNode)->setInsetLeft(pFloat);
} else if(strcmp(pPropertyName, PROPERTY_INSETTOP) == 0) {
@ -68,7 +68,7 @@ void Scale9SpriteLoader::onHandlePropTypeFloat(Node * pNode, Node * pParent, con
} else if(strcmp(pPropertyName, PROPERTY_INSETBOTTOM) == 0) {
((Scale9Sprite *)pNode)->setInsetBottom(pFloat);
} else {
NodeLoader::onHandlePropTypeFloat(pNode, pParent, pPropertyName, pFloat, pCCBReader);
NodeLoader::onHandlePropTypeFloat(pNode, pParent, pPropertyName, pFloat, ccbReader);
}
}

View File

@ -18,12 +18,12 @@ class Scale9SpriteLoader : public NodeLoader {
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(Scale9Sprite);
virtual void onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, Color3B pColor3B, CCBReader * pCCBReader);
virtual void onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, BlendFunc pBlendFunc, CCBReader * pCCBReader);
virtual void onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, const char * pPropertyName, SpriteFrame * pSpriteFrame, CCBReader * pCCBReader);
virtual void onHandlePropTypeSize(Node * pNode, Node * pParent, const char * pPropertyName, Size pSize, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloat(Node * pNode, Node * pParent, const char * pPropertyName, float pFloat, CCBReader * pCCBReader);
virtual void onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, Color3B pColor3B, CCBReader * ccbReader);
virtual void onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * ccbReader);
virtual void onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, BlendFunc pBlendFunc, CCBReader * ccbReader);
virtual void onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, const char * pPropertyName, SpriteFrame * pSpriteFrame, CCBReader * ccbReader);
virtual void onHandlePropTypeSize(Node * pNode, Node * pParent, const char * pPropertyName, Size pSize, CCBReader * ccbReader);
virtual void onHandlePropTypeFloat(Node * pNode, Node * pParent, const char * pPropertyName, float pFloat, CCBReader * ccbReader);
};
NS_CC_EXT_END

View File

@ -10,46 +10,46 @@
NS_CC_EXT_BEGIN
void ScrollViewLoader::onHandlePropTypeSize(Node * pNode, Node * pParent, const char * pPropertyName, Size pSize, CCBReader * pCCBReader) {
void ScrollViewLoader::onHandlePropTypeSize(Node * pNode, Node * pParent, const char * pPropertyName, Size pSize, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_CONTENTSIZE) == 0) {
((ScrollView *)pNode)->setViewSize(pSize);
} else {
NodeLoader::onHandlePropTypeSize(pNode, pParent, pPropertyName, pSize, pCCBReader);
NodeLoader::onHandlePropTypeSize(pNode, pParent, pPropertyName, pSize, ccbReader);
}
}
void ScrollViewLoader::onHandlePropTypeCheck(Node * pNode, Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
void ScrollViewLoader::onHandlePropTypeCheck(Node * pNode, Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_CLIPSTOBOUNDS) == 0) {
((ScrollView *)pNode)->setClippingToBounds(pCheck);
} else if(strcmp(pPropertyName, PROPERTY_BOUNCES) == 0) {
((ScrollView *)pNode)->setBounceable(pCheck);
} else {
NodeLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, pCCBReader);
NodeLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, ccbReader);
}
}
void ScrollViewLoader::onHandlePropTypeCCBFile(Node * pNode, Node * pParent, const char * pPropertyName, Node * pCCBFileNode, CCBReader * pCCBReader) {
void ScrollViewLoader::onHandlePropTypeCCBFile(Node * pNode, Node * pParent, const char * pPropertyName, Node * pCCBFileNode, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_CONTAINER) == 0) {
((ScrollView *)pNode)->setContainer(pCCBFileNode);
((ScrollView *)pNode)->updateInset();
} else {
NodeLoader::onHandlePropTypeCCBFile(pNode, pParent, pPropertyName, pCCBFileNode, pCCBReader);
NodeLoader::onHandlePropTypeCCBFile(pNode, pParent, pPropertyName, pCCBFileNode, ccbReader);
}
}
void ScrollViewLoader::onHandlePropTypeFloat(Node * pNode, Node * pParent, const char * pPropertyName, float pFloat, CCBReader * pCCBReader) {
void ScrollViewLoader::onHandlePropTypeFloat(Node * pNode, Node * pParent, const char * pPropertyName, float pFloat, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_SCALE) == 0) {
((ScrollView *)pNode)->setScale(pFloat);
} else {
NodeLoader::onHandlePropTypeFloat(pNode, pParent, pPropertyName, pFloat, pCCBReader);
NodeLoader::onHandlePropTypeFloat(pNode, pParent, pPropertyName, pFloat, ccbReader);
}
}
void ScrollViewLoader::onHandlePropTypeIntegerLabeled(Node * pNode, Node * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader) {
void ScrollViewLoader::onHandlePropTypeIntegerLabeled(Node * pNode, Node * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_DIRECTION) == 0) {
((ScrollView *)pNode)->setDirection(ScrollView::Direction(pIntegerLabeled));
} else {
NodeLoader::onHandlePropTypeFloatScale(pNode, pParent, pPropertyName, pIntegerLabeled, pCCBReader);
NodeLoader::onHandlePropTypeFloatScale(pNode, pParent, pPropertyName, pIntegerLabeled, ccbReader);
}
}

View File

@ -16,11 +16,11 @@ class ScrollViewLoader : public NodeLoader {
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(ScrollView);
virtual void onHandlePropTypeSize(Node * pNode, Node * pParent, const char * pPropertyName, Size pSize, CCBReader * pCCBReader);
virtual void onHandlePropTypeCCBFile(Node * pNode, Node * pParent, const char * pPropertyName, Node * pCCBFileNode, CCBReader * pCCBReader);
virtual void onHandlePropTypeCheck(Node * pNode, Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloat(Node * pNode, Node * pParent, const char * pPropertyName, float pFloat, CCBReader * pCCBReader);
virtual void onHandlePropTypeIntegerLabeled(Node * pNode, Node * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader);
virtual void onHandlePropTypeSize(Node * pNode, Node * pParent, const char * pPropertyName, Size pSize, CCBReader * ccbReader);
virtual void onHandlePropTypeCCBFile(Node * pNode, Node * pParent, const char * pPropertyName, Node * pCCBFileNode, CCBReader * ccbReader);
virtual void onHandlePropTypeCheck(Node * pNode, Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * ccbReader);
virtual void onHandlePropTypeFloat(Node * pNode, Node * pParent, const char * pPropertyName, float pFloat, CCBReader * ccbReader);
virtual void onHandlePropTypeIntegerLabeled(Node * pNode, Node * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * ccbReader);
};
NS_CC_EXT_END

View File

@ -8,7 +8,7 @@
NS_CC_EXT_BEGIN
void SpriteLoader::onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, const char * pPropertyName, SpriteFrame * pSpriteFrame, CCBReader * pCCBReader) {
void SpriteLoader::onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, const char * pPropertyName, SpriteFrame * pSpriteFrame, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_DISPLAYFRAME) == 0) {
if(pSpriteFrame != NULL) {
((Sprite *)pNode)->setDisplayFrame(pSpriteFrame);
@ -16,40 +16,40 @@ void SpriteLoader::onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, con
CCLOG("ERROR: SpriteFrame NULL");
}
} else {
NodeLoader::onHandlePropTypeSpriteFrame(pNode, pParent, pPropertyName, pSpriteFrame, pCCBReader);
NodeLoader::onHandlePropTypeSpriteFrame(pNode, pParent, pPropertyName, pSpriteFrame, ccbReader);
}
}
void SpriteLoader::onHandlePropTypeFlip(Node * pNode, Node * pParent, const char * pPropertyName, bool * pFlip, CCBReader * pCCBReader) {
void SpriteLoader::onHandlePropTypeFlip(Node * pNode, Node * pParent, const char * pPropertyName, bool * pFlip, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_FLIP) == 0) {
((Sprite *)pNode)->setFlipX(pFlip[0]);
((Sprite *)pNode)->setFlipY(pFlip[1]);
} else {
NodeLoader::onHandlePropTypeFlip(pNode, pParent, pPropertyName, pFlip, pCCBReader);
NodeLoader::onHandlePropTypeFlip(pNode, pParent, pPropertyName, pFlip, ccbReader);
}
}
void SpriteLoader::onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, Color3B pColor3B, CCBReader * pCCBReader) {
void SpriteLoader::onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, Color3B pColor3B, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_COLOR) == 0) {
((Sprite *)pNode)->setColor(pColor3B);
} else {
NodeLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pColor3B, pCCBReader);
NodeLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pColor3B, ccbReader);
}
}
void SpriteLoader::onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
void SpriteLoader::onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_OPACITY) == 0) {
((Sprite *)pNode)->setOpacity(pByte);
} else {
NodeLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, pCCBReader);
NodeLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, ccbReader);
}
}
void SpriteLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, BlendFunc pBlendFunc, CCBReader * pCCBReader) {
void SpriteLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, BlendFunc pBlendFunc, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
((Sprite *)pNode)->setBlendFunc(pBlendFunc);
} else {
NodeLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pBlendFunc, pCCBReader);
NodeLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pBlendFunc, ccbReader);
}
}

View File

@ -16,11 +16,11 @@ class SpriteLoader : public NodeLoader {
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(Sprite);
virtual void onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, Color3B pColor3B, CCBReader * pCCBReader);
virtual void onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, BlendFunc pCCBBlendFunc, CCBReader * pCCBReader);
virtual void onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, const char * pPropertyName, SpriteFrame * pSpriteFrame, CCBReader * pCCBReader);
virtual void onHandlePropTypeFlip(Node * pNode, Node * pParent, const char * pPropertyName, bool * pFlip, CCBReader * pCCBReader);
virtual void onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, Color3B pColor3B, CCBReader * ccbReader);
virtual void onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * ccbReader);
virtual void onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, BlendFunc pCCBBlendFunc, CCBReader * ccbReader);
virtual void onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, const char * pPropertyName, SpriteFrame * pSpriteFrame, CCBReader * ccbReader);
virtual void onHandlePropTypeFlip(Node * pNode, Node * pParent, const char * pPropertyName, bool * pFlip, CCBReader * ccbReader);
};
NS_CC_EXT_END

View File

@ -183,6 +183,15 @@ CC_DEPRECATED_ATTRIBUTE typedef Control::State CCControlState;
CC_DEPRECATED_ATTRIBUTE typedef Control::Handler SEL_CCControlHandler;
// For CCBReader
CC_DEPRECATED_ATTRIBUTE const int kIntValue = CCBValue::TYPE_INT;
CC_DEPRECATED_ATTRIBUTE const int kFloatValue = CCBValue::TYPE_FLOAT;
CC_DEPRECATED_ATTRIBUTE const int kBoolValue = CCBValue::TYPE_BOOL;
CC_DEPRECATED_ATTRIBUTE const int kUnsignedCharValue = CCBValue::TYPE_UNSIGNED_CHAR;
CC_DEPRECATED_ATTRIBUTE const int kStringValue = CCBValue::TYPE_STRING;
CC_DEPRECATED_ATTRIBUTE const int kArrayValue = CCBValue::TYPE_ARRAY;
NS_CC_EXT_END

View File

@ -43,7 +43,7 @@ NS_CC_EXT_BEGIN
* @{
*/
#define cccontrol_selector(_SELECTOR) (Control::Handler)(&_SELECTOR)
#define cccontrol_selector(_SELECTOR) static_cast<cocos2d::extension::Control::Handler>(&_SELECTOR)
class Invocation : public Object
{

View File

@ -17,11 +17,12 @@ SEL_MenuHandler AnimationsTestLayer::onResolveCCBCCMenuItemSelector(Object * pTa
return NULL;
}
Control::Handler AnimationsTestLayer::onResolveCCBCCControlSelector(Object *pTarget, const char*pSelectorName) {
CCB_SELECTORRESOLVER_CCCONTROL_GLUE(this, "onControlButtonIdleClicked", AnimationsTestLayer::onControlButtonIdleClicked);
CCB_SELECTORRESOLVER_CCCONTROL_GLUE(this, "onControlButtonWaveClicked", AnimationsTestLayer::onControlButtonWaveClicked);
CCB_SELECTORRESOLVER_CCCONTROL_GLUE(this, "onControlButtonJumpClicked", AnimationsTestLayer::onControlButtonJumpClicked);
CCB_SELECTORRESOLVER_CCCONTROL_GLUE(this, "onControlButtonFunkyClicked", AnimationsTestLayer::onControlButtonFunkyClicked);
Control::Handler AnimationsTestLayer::onResolveCCBCCControlSelector(Object *pTarget, const char*pSelectorName)
{
CCB_SELECTORRESOLVER_CCCONTROL_GLUE(this, "onCCControlButtonIdleClicked", AnimationsTestLayer::onControlButtonIdleClicked);
CCB_SELECTORRESOLVER_CCCONTROL_GLUE(this, "onCCControlButtonWaveClicked", AnimationsTestLayer::onControlButtonWaveClicked);
CCB_SELECTORRESOLVER_CCCONTROL_GLUE(this, "onCCControlButtonJumpClicked", AnimationsTestLayer::onControlButtonJumpClicked);
CCB_SELECTORRESOLVER_CCCONTROL_GLUE(this, "onCCControlButtonFunkyClicked", AnimationsTestLayer::onControlButtonFunkyClicked);
return NULL;
}

View File

@ -17,13 +17,13 @@ SEL_MenuHandler ButtonTestLayer::onResolveCCBCCMenuItemSelector(Object * pTarget
}
Control::Handler ButtonTestLayer::onResolveCCBCCControlSelector(Object * pTarget, const char * pSelectorName) {
CCB_SELECTORRESOLVER_CCCONTROL_GLUE(this, "onControlButtonClicked", ButtonTestLayer::onControlButtonClicked);
CCB_SELECTORRESOLVER_CCCONTROL_GLUE(this, "onCCControlButtonClicked", ButtonTestLayer::onControlButtonClicked);
return NULL;
}
bool ButtonTestLayer::onAssignCCBMemberVariable(Object * pTarget, const char * pMemberVariableName, Node * pNode) {
CCB_MEMBERVARIABLEASSIGNER_GLUE(this, "mControlEventLabel", LabelBMFont *, this->mControlEventLabel);
CCB_MEMBERVARIABLEASSIGNER_GLUE(this, "mCCControlEventLabel", LabelBMFont *, this->mControlEventLabel);
return false;
}

View File

@ -22,7 +22,7 @@ Control::Handler TimelineCallbackTestLayer::onResolveCCBCCControlSelector(Object
return NULL;
}
SEL_CallFuncN TimelineCallbackTestLayer::onResolveCCBCallFuncSelector(Object * pTarget, const char* pSelectorName)
SEL_CallFuncN TimelineCallbackTestLayer::onResolveCCBCCCallFuncSelector(Object * pTarget, const char* pSelectorName)
{
CCB_SELECTORRESOLVER_CALLFUNC_GLUE(this, "onCallback1", TimelineCallbackTestLayer::onCallback1);
CCB_SELECTORRESOLVER_CALLFUNC_GLUE(this, "onCallback2", TimelineCallbackTestLayer::onCallback2);

View File

@ -17,7 +17,7 @@ class TimelineCallbackTestLayer
virtual cocos2d::SEL_MenuHandler onResolveCCBCCMenuItemSelector(cocos2d::Object * pTarget, const char * pSelectorName);
virtual cocos2d::extension::Control::Handler onResolveCCBCCControlSelector(cocos2d::Object * pTarget, const char * pSelectorName);
virtual cocos2d::SEL_CallFuncN onResolveCCBCallFuncSelector(Object * pTarget, const char* pSelectorName);
virtual cocos2d::SEL_CallFuncN onResolveCCBCCCallFuncSelector(Object * pTarget, const char* pSelectorName);
virtual bool onAssignCCBMemberVariable(cocos2d::Object * pTarget, const char * pMemberVariableName, cocos2d::Node * node);
void onCallback1(Node* sender);

View File

@ -1 +1 @@
8afb042695f24ec222ea28a558b08174d9119ea9
c7a6c9185c7f11c304707b16497c238c0d4588e7