member variables renaming according cocos2d-x style.

This commit is contained in:
James Chen 2013-07-27 22:31:57 +08:00
parent e66e429bb2
commit fa5c26c5e2
15 changed files with 374 additions and 374 deletions

View File

@ -26,7 +26,7 @@ CCBAnimationManager::CCBAnimationManager()
, _delegate(NULL)
, _runningSequence(NULL)
, _jsControlled(false)
, mOwner(NULL)
, _owner(NULL)
{
init();
}
@ -42,7 +42,7 @@ bool CCBAnimationManager::init()
_documentCallbackNames = new Array();
_documentCallbackNodes = new Array();
_keyframeCallbacks = new Array();
mKeyframeCallFuncs = new Dictionary();
_keyframeCallFuncs = new Dictionary();
_target = NULL;
_animationCompleteCallbackFunc = NULL;
@ -76,7 +76,7 @@ CCBAnimationManager::~CCBAnimationManager()
CC_SAFE_RELEASE(_documentCallbackNames);
CC_SAFE_RELEASE(_documentCallbackNodes);
CC_SAFE_RELEASE(mKeyframeCallFuncs);
CC_SAFE_RELEASE(_keyframeCallFuncs);
CC_SAFE_RELEASE(_keyframeCallbacks);
CC_SAFE_RELEASE(_target);
}
@ -602,7 +602,7 @@ Object* CCBAnimationManager::actionForCallbackChannel(CCBSequenceProperty* chann
if(_jsControlled) {
String* callbackName = String::createWithFormat("%d:%s", selectorTarget, selectorName.c_str());
CallFunc *callback = ((CallFunc*)(mKeyframeCallFuncs->objectForKey(callbackName->getCString())))->clone();
CallFunc *callback = ((CallFunc*)(_keyframeCallFuncs->objectForKey(callbackName->getCString())))->clone();
if(callback != NULL) {
actions->addObject(callback);
@ -615,7 +615,7 @@ Object* CCBAnimationManager::actionForCallbackChannel(CCBSequenceProperty* chann
if(selectorTarget == CCBReader::TargetType::DOCUMENT_ROOT)
target = _rootNode;
else if (selectorTarget == CCBReader::TargetType::OWNER)
target = mOwner;
target = _owner;
if(target != NULL)
{
@ -859,7 +859,7 @@ void CCBAnimationManager::setAnimationCompletedCallback(Object *target, SEL_Call
}
void CCBAnimationManager::setCallFunc(CallFunc* callFunc, const std::string &callbackNamed) {
mKeyframeCallFuncs->setObject((Object*)callFunc, callbackNamed);
_keyframeCallFuncs->setObject((Object*)callFunc, callbackNamed);
}
void CCBAnimationManager::sequenceCompleted()
@ -915,22 +915,22 @@ CCBSetSpriteFrame* CCBSetSpriteFrame::create(SpriteFrame *pSpriteFrame)
bool CCBSetSpriteFrame::initWithSpriteFrame(SpriteFrame *pSpriteFrame)
{
mSpriteFrame = pSpriteFrame;
CC_SAFE_RETAIN(mSpriteFrame);
_spriteFrame = pSpriteFrame;
CC_SAFE_RETAIN(_spriteFrame);
return true;
}
CCBSetSpriteFrame::~CCBSetSpriteFrame()
{
CC_SAFE_RELEASE_NULL(mSpriteFrame);
CC_SAFE_RELEASE_NULL(_spriteFrame);
}
CCBSetSpriteFrame* CCBSetSpriteFrame::clone() const
{
// no copy constructor
auto a = new CCBSetSpriteFrame();
a->initWithSpriteFrame(mSpriteFrame);
a->initWithSpriteFrame(_spriteFrame);
a->autorelease();
return a;
}
@ -943,7 +943,7 @@ CCBSetSpriteFrame* CCBSetSpriteFrame::reverse() const
void CCBSetSpriteFrame::update(float time)
{
((Sprite*)_target)->setDisplayFrame(mSpriteFrame);
((Sprite*)_target)->setDisplayFrame(_spriteFrame);
}
@ -970,10 +970,10 @@ CCBSoundEffect::~CCBSoundEffect()
}
bool CCBSoundEffect::initWithSoundFile(const std::string &filename, float pitch, float pan, float gain) {
mSoundFile = filename;
mPitch = pitch;
mPan = pan;
mGain = gain;
_soundFile = filename;
_pitch = pitch;
_pan = pan;
_gain = gain;
return true;
}
@ -981,7 +981,7 @@ CCBSoundEffect* CCBSoundEffect::clone() const
{
// no copy constructor
auto a = new CCBSoundEffect();
a->initWithSoundFile(mSoundFile, mPitch, mPan, mGain);
a->initWithSoundFile(_soundFile, _pitch, _pan, _gain);
a->autorelease();
return a;
}
@ -994,7 +994,7 @@ CCBSoundEffect* CCBSoundEffect::reverse() const
void CCBSoundEffect::update(float time)
{
CocosDenshion::SimpleAudioEngine::getInstance()->playEffect(mSoundFile.c_str());
CocosDenshion::SimpleAudioEngine::getInstance()->playEffect(_soundFile.c_str());
}
@ -1024,7 +1024,7 @@ bool CCBRotateTo::initWithDuration(float fDuration, float fAngle)
{
if (ActionInterval::initWithDuration(fDuration))
{
mDstAngle = fAngle;
_dstAngle = fAngle;
return true;
}
@ -1038,7 +1038,7 @@ CCBRotateTo* CCBRotateTo::clone() const
{
// no copy constructor
auto a = new CCBRotateTo();
a->initWithDuration(_duration, mDstAngle);
a->initWithDuration(_duration, _dstAngle);
a->autorelease();
return a;
}
@ -1052,13 +1052,13 @@ CCBRotateTo* CCBRotateTo::reverse() const
void CCBRotateTo::startWithTarget(Node *pNode)
{
ActionInterval::startWithTarget(pNode);
mStartAngle = _target->getRotation();
mDiffAngle = mDstAngle - mStartAngle;
_startAngle = _target->getRotation();
_diffAngle = _dstAngle - _startAngle;
}
void CCBRotateTo::update(float time)
{
_target->setRotation(mStartAngle + (mDiffAngle * time))
_target->setRotation(_startAngle + (_diffAngle * time))
;
}
@ -1092,7 +1092,7 @@ bool CCBRotateXTo::initWithDuration(float fDuration, float fAngle)
{
if (ActionInterval::initWithDuration(fDuration))
{
mDstAngle = fAngle;
_dstAngle = fAngle;
return true;
}
@ -1110,15 +1110,15 @@ void CCBRotateXTo::startWithTarget(Node *pNode)
_target = pNode;
_elapsed = 0.0f;
_firstTick = true;
mStartAngle = _target->getRotationX();
mDiffAngle = mDstAngle - mStartAngle;
_startAngle = _target->getRotationX();
_diffAngle = _dstAngle - _startAngle;
}
CCBRotateXTo* CCBRotateXTo::clone() const
{
// no copy constructor
auto a = new CCBRotateXTo();
a->initWithDuration(_duration, mDstAngle);
a->initWithDuration(_duration, _dstAngle);
a->autorelease();
return a;
}
@ -1131,7 +1131,7 @@ CCBRotateXTo* CCBRotateXTo::reverse() const
void CCBRotateXTo::update(float time)
{
_target->setRotationX(mStartAngle + (mDiffAngle * time))
_target->setRotationX(_startAngle + (_diffAngle * time))
;
}
@ -1165,7 +1165,7 @@ bool CCBRotateYTo::initWithDuration(float fDuration, float fAngle)
{
if (ActionInterval::initWithDuration(fDuration))
{
mDstAngle = fAngle;
_dstAngle = fAngle;
return true;
}
@ -1179,7 +1179,7 @@ CCBRotateYTo* CCBRotateYTo::clone() const
{
// no copy constructor
auto a = new CCBRotateYTo();
a->initWithDuration(_duration, mDstAngle);
a->initWithDuration(_duration, _dstAngle);
a->autorelease();
return a;
}
@ -1198,13 +1198,13 @@ void CCBRotateYTo::startWithTarget(Node *pNode)
_target = pNode;
_elapsed = 0.0f;
_firstTick = true;
mStartAngle = _target->getRotationY();
mDiffAngle = mDstAngle - mStartAngle;
_startAngle = _target->getRotationY();
_diffAngle = _dstAngle - _startAngle;
}
void CCBRotateYTo::update(float time)
{
_target->setRotationY(mStartAngle + (mDiffAngle * time))
_target->setRotationY(_startAngle + (_diffAngle * time))
;
}

View File

@ -17,40 +17,13 @@ public:
class CCBAnimationManager : public Object
{
private:
Array *_sequences;
Dictionary *_nodeSequences;
Dictionary *_baseValues;
int _autoPlaySequenceId;
Node *_rootNode;
Size _rootContainerSize;
CCBAnimationManagerDelegate *_delegate;
CCBSequence *_runningSequence;
Array *_documentOutletNames;
Array *_documentOutletNodes;
Array *_documentCallbackNames;
Array *_documentCallbackNodes;
Array *_keyframeCallbacks;
Dictionary *mKeyframeCallFuncs;
std::string _documentControllerName;
std::string _lastCompletedSequenceName;
SEL_CallFunc _animationCompleteCallbackFunc;
Object *_target;
public:
bool _jsControlled;
CCBAnimationManager();
~CCBAnimationManager();
Object *mOwner;
Object *_owner;
virtual bool init();
@ -125,6 +98,32 @@ private:
ActionInterval* getEaseAction(ActionInterval *pAction, CCBKeyframe::EasingType easingType, float fEasingOpt);
void runAction(Node *pNode, CCBSequenceProperty *pSeqProp, float fTweenDuration);
void sequenceCompleted();
private:
Array *_sequences;
Dictionary *_nodeSequences;
Dictionary *_baseValues;
int _autoPlaySequenceId;
Node *_rootNode;
Size _rootContainerSize;
CCBAnimationManagerDelegate *_delegate;
CCBSequence *_runningSequence;
Array *_documentOutletNames;
Array *_documentOutletNodes;
Array *_documentCallbackNames;
Array *_documentCallbackNodes;
Array *_keyframeCallbacks;
Dictionary *_keyframeCallFuncs;
std::string _documentControllerName;
std::string _lastCompletedSequenceName;
SEL_CallFunc _animationCompleteCallbackFunc;
Object *_target;
};
class CCBSetSpriteFrame : public ActionInstant
@ -143,7 +142,7 @@ public:
virtual CCBSetSpriteFrame* reverse() const override;
private:
SpriteFrame *mSpriteFrame;
SpriteFrame *_spriteFrame;
};
@ -160,8 +159,8 @@ public:
virtual CCBSoundEffect* reverse() const override;
private:
std::string mSoundFile;
float mPitch, mPan, mGain;
std::string _soundFile;
float _pitch, _pan, _gain;
};
@ -178,9 +177,9 @@ public:
virtual void startWithTarget(Node *pNode) override;
private:
float mStartAngle;
float mDstAngle;
float mDiffAngle;
float _startAngle;
float _dstAngle;
float _diffAngle;
};
@ -197,9 +196,9 @@ public:
virtual void update(float time) override;
private:
float mStartAngle;
float mDstAngle;
float mDiffAngle;
float _startAngle;
float _dstAngle;
float _diffAngle;
};
@ -216,9 +215,9 @@ public:
virtual void update(float time) override;
private:
float mStartAngle;
float mDstAngle;
float mDiffAngle;
float _startAngle;
float _dstAngle;
float _diffAngle;
};

View File

@ -5,57 +5,57 @@ using namespace cocos2d;
NS_CC_EXT_BEGIN
CCBKeyframe::CCBKeyframe()
: mValue(NULL)
, mTime(0.0f)
, mEasingType(EasingType::INSTANT)
, mEasingOpt(0.0f)
: _value(NULL)
, _time(0.0f)
, _easingType(EasingType::INSTANT)
, _easingOpt(0.0f)
{}
CCBKeyframe::~CCBKeyframe()
{
CC_SAFE_RELEASE_NULL(mValue);
CC_SAFE_RELEASE_NULL(_value);
}
Object* CCBKeyframe::getValue()
{
return mValue;
return _value;
}
void CCBKeyframe::setValue(Object *pValue)
{
CC_SAFE_RELEASE(mValue);
mValue = pValue;
CC_SAFE_RETAIN(mValue);
CC_SAFE_RELEASE(_value);
_value = pValue;
CC_SAFE_RETAIN(_value);
}
float CCBKeyframe::getTime()
{
return mTime;
return _time;
}
void CCBKeyframe::setTime(float fTime)
{
mTime = fTime;
_time = fTime;
}
CCBKeyframe::EasingType CCBKeyframe::getEasingType()
{
return mEasingType;
return _easingType;
}
void CCBKeyframe::setEasingType(CCBKeyframe::EasingType easingType)
{
mEasingType = easingType;
_easingType = easingType;
}
float CCBKeyframe::getEasingOpt()
{
return mEasingOpt;
return _easingOpt;
}
void CCBKeyframe::setEasingOpt(float fEasingOpt)
{
mEasingOpt = fEasingOpt;
_easingOpt = fEasingOpt;
}
NS_CC_EXT_END

View File

@ -48,10 +48,10 @@ public:
void setEasingOpt(float fEasingOpt);
private:
Object *mValue;
float mTime;
EasingType mEasingType;
float mEasingOpt;
Object *_value;
float _time;
EasingType _easingType;
float _easingOpt;
};
NS_CC_EXT_END

View File

@ -22,7 +22,7 @@ NS_CC_EXT_BEGIN;
Implementation of CCBFile
*************************************************************************/
CCBFile::CCBFile():mCCBFileNode(NULL) {}
CCBFile::CCBFile():_CCBFileNode(NULL) {}
CCBFile* CCBFile::create()
{
@ -38,14 +38,14 @@ CCBFile* CCBFile::create()
Node* CCBFile::getCCBFileNode()
{
return mCCBFileNode;
return _CCBFileNode;
}
void CCBFile::setCCBFileNode(Node *pNode)
{
CC_SAFE_RELEASE(mCCBFileNode);
mCCBFileNode = pNode;
CC_SAFE_RETAIN(mCCBFileNode);
CC_SAFE_RELEASE(_CCBFileNode);
_CCBFileNode = pNode;
CC_SAFE_RETAIN(_CCBFileNode);
}
/*************************************************************************
@ -53,111 +53,111 @@ void CCBFile::setCCBFileNode(Node *pNode)
*************************************************************************/
CCBReader::CCBReader(NodeLoaderLibrary * pNodeLoaderLibrary, CCBMemberVariableAssigner * pCCBMemberVariableAssigner, CCBSelectorResolver * pCCBSelectorResolver, NodeLoaderListener * pNodeLoaderListener)
: mData(NULL)
, mBytes(NULL)
, mCurrentByte(-1)
, mCurrentBit(-1)
, mOwner(NULL)
, mActionManager(NULL)
, mActionManagers(NULL)
, mAnimatedProps(NULL)
, mOwnerOutletNodes(NULL)
, mNodesWithAnimationManagers(NULL)
, mAnimationManagersForNodes(NULL)
, mOwnerCallbackNodes(NULL)
, hasScriptingOwner(false)
: _data(NULL)
, _bytes(NULL)
, _currentByte(-1)
, _currentBit(-1)
, _owner(NULL)
, _actionManager(NULL)
, _actionManagers(NULL)
, _animatedProps(NULL)
, _ownerOutletNodes(NULL)
, _nodesWithAnimationManagers(NULL)
, _animationManagersForNodes(NULL)
, _ownerCallbackNodes(NULL)
, _hasScriptingOwner(false)
{
this->mNodeLoaderLibrary = pNodeLoaderLibrary;
this->mNodeLoaderLibrary->retain();
this->mCCBMemberVariableAssigner = pCCBMemberVariableAssigner;
this->mCCBSelectorResolver = pCCBSelectorResolver;
this->mNodeLoaderListener = pNodeLoaderListener;
this->_nodeLoaderLibrary = pNodeLoaderLibrary;
this->_nodeLoaderLibrary->retain();
this->_CCBMemberVariableAssigner = pCCBMemberVariableAssigner;
this->_CCBSelectorResolver = pCCBSelectorResolver;
this->_nodeLoaderListener = pNodeLoaderListener;
init();
}
CCBReader::CCBReader(CCBReader * ccbReader)
: mData(NULL)
, mBytes(NULL)
, mCurrentByte(-1)
, mCurrentBit(-1)
, mOwner(NULL)
, mActionManager(NULL)
, mActionManagers(NULL)
, mAnimatedProps(NULL)
, mOwnerOutletNodes(NULL)
, mNodesWithAnimationManagers(NULL)
, mAnimationManagersForNodes(NULL)
, mOwnerCallbackNodes(NULL)
, hasScriptingOwner(false)
: _data(NULL)
, _bytes(NULL)
, _currentByte(-1)
, _currentBit(-1)
, _owner(NULL)
, _actionManager(NULL)
, _actionManagers(NULL)
, _animatedProps(NULL)
, _ownerOutletNodes(NULL)
, _nodesWithAnimationManagers(NULL)
, _animationManagersForNodes(NULL)
, _ownerCallbackNodes(NULL)
, _hasScriptingOwner(false)
{
this->mLoadedSpriteSheets = ccbReader->mLoadedSpriteSheets;
this->mNodeLoaderLibrary = ccbReader->mNodeLoaderLibrary;
this->mNodeLoaderLibrary->retain();
this->_loadedSpriteSheets = ccbReader->_loadedSpriteSheets;
this->_nodeLoaderLibrary = ccbReader->_nodeLoaderLibrary;
this->_nodeLoaderLibrary->retain();
this->mCCBMemberVariableAssigner = ccbReader->mCCBMemberVariableAssigner;
this->mCCBSelectorResolver = ccbReader->mCCBSelectorResolver;
this->mNodeLoaderListener = ccbReader->mNodeLoaderListener;
this->_CCBMemberVariableAssigner = ccbReader->_CCBMemberVariableAssigner;
this->_CCBSelectorResolver = ccbReader->_CCBSelectorResolver;
this->_nodeLoaderListener = ccbReader->_nodeLoaderListener;
this->mOwnerCallbackNames = ccbReader->mOwnerCallbackNames;
this->mOwnerCallbackNodes = ccbReader->mOwnerCallbackNodes;
this->mOwnerCallbackNodes->retain();
this->mOwnerOutletNames = ccbReader->mOwnerOutletNames;
this->mOwnerOutletNodes = ccbReader->mOwnerOutletNodes;
this->mOwnerOutletNodes->retain();
this->_ownerCallbackNames = ccbReader->_ownerCallbackNames;
this->_ownerCallbackNodes = ccbReader->_ownerCallbackNodes;
this->_ownerCallbackNodes->retain();
this->_ownerOutletNames = ccbReader->_ownerOutletNames;
this->_ownerOutletNodes = ccbReader->_ownerOutletNodes;
this->_ownerOutletNodes->retain();
this->mCCBRootPath = ccbReader->getCCBRootPath();
this->_CCBRootPath = ccbReader->getCCBRootPath();
init();
}
CCBReader::CCBReader()
: mData(NULL)
, mBytes(NULL)
, mCurrentByte(-1)
, mCurrentBit(-1)
, mOwner(NULL)
, mActionManager(NULL)
, mActionManagers(NULL)
, mNodeLoaderLibrary(NULL)
, mNodeLoaderListener(NULL)
, mCCBMemberVariableAssigner(NULL)
, mCCBSelectorResolver(NULL)
, mNodesWithAnimationManagers(NULL)
, mAnimationManagersForNodes(NULL)
, hasScriptingOwner(false)
: _data(NULL)
, _bytes(NULL)
, _currentByte(-1)
, _currentBit(-1)
, _owner(NULL)
, _actionManager(NULL)
, _actionManagers(NULL)
, _nodeLoaderLibrary(NULL)
, _nodeLoaderListener(NULL)
, _CCBMemberVariableAssigner(NULL)
, _CCBSelectorResolver(NULL)
, _nodesWithAnimationManagers(NULL)
, _animationManagersForNodes(NULL)
, _hasScriptingOwner(false)
{
init();
}
CCBReader::~CCBReader() {
CC_SAFE_RELEASE_NULL(mOwner);
CC_SAFE_RELEASE_NULL(mData);
CC_SAFE_RELEASE_NULL(_owner);
CC_SAFE_RELEASE_NULL(_data);
this->mNodeLoaderLibrary->release();
this->_nodeLoaderLibrary->release();
CC_SAFE_RELEASE(mOwnerOutletNodes);
mOwnerOutletNames.clear();
CC_SAFE_RELEASE(mOwnerCallbackNodes);
mOwnerCallbackNames.clear();
CC_SAFE_RELEASE(_ownerOutletNodes);
_ownerOutletNames.clear();
CC_SAFE_RELEASE(_ownerCallbackNodes);
_ownerCallbackNames.clear();
// Clear string cache.
this->mStringCache.clear();
CC_SAFE_RELEASE(mNodesWithAnimationManagers);
CC_SAFE_RELEASE(mAnimationManagersForNodes);
this->_stringCache.clear();
CC_SAFE_RELEASE(_nodesWithAnimationManagers);
CC_SAFE_RELEASE(_animationManagersForNodes);
setAnimationManager(NULL);
}
void CCBReader::setCCBRootPath(const char* pCCBRootPath)
void CCBReader::setCCBRootPath(const char* ccbRootPath)
{
CCASSERT(pCCBRootPath != NULL, "");
mCCBRootPath = pCCBRootPath;
CCASSERT(ccbRootPath != NULL, "");
_CCBRootPath = ccbRootPath;
}
const std::string& CCBReader::getCCBRootPath() const
{
return mCCBRootPath;
return _CCBRootPath;
}
bool CCBReader::init()
@ -168,54 +168,54 @@ bool CCBReader::init()
pActionManager->release();
// Setup resolution scale and container size
mActionManager->setRootContainerSize(Director::getInstance()->getWinSize());
_actionManager->setRootContainerSize(Director::getInstance()->getWinSize());
return true;
}
CCBAnimationManager* CCBReader::getAnimationManager()
{
return mActionManager;
return _actionManager;
}
void CCBReader::setAnimationManager(CCBAnimationManager *pAnimationManager)
{
CC_SAFE_RELEASE(mActionManager);
mActionManager = pAnimationManager;
CC_SAFE_RETAIN(mActionManager);
CC_SAFE_RELEASE(_actionManager);
_actionManager = pAnimationManager;
CC_SAFE_RETAIN(_actionManager);
}
Dictionary* CCBReader::getAnimationManagers()
{
return mActionManagers;
return _actionManagers;
}
void CCBReader::setAnimationManagers(Dictionary* x)
{
mActionManagers = x;
_actionManagers = x;
}
CCBMemberVariableAssigner * CCBReader::getCCBMemberVariableAssigner() {
return this->mCCBMemberVariableAssigner;
return this->_CCBMemberVariableAssigner;
}
CCBSelectorResolver * CCBReader::getCCBSelectorResolver() {
return this->mCCBSelectorResolver;
return this->_CCBSelectorResolver;
}
set<string>* CCBReader::getAnimatedProperties()
{
return mAnimatedProps;
return _animatedProps;
}
set<string>& CCBReader::getLoadedSpriteSheet()
{
return mLoadedSpriteSheets;
return _loadedSpriteSheets;
}
Object* CCBReader::getOwner()
{
return mOwner;
return _owner;
}
Node* CCBReader::readNodeGraphFromFile(const char *pCCBFileName)
@ -259,31 +259,31 @@ Node* CCBReader::readNodeGraphFromFile(const char *pCCBFileName, Object *pOwner,
Node* CCBReader::readNodeGraphFromData(Data *pData, Object *pOwner, const Size &parentSize)
{
mData = pData;
CC_SAFE_RETAIN(mData);
mBytes = mData->getBytes();
mCurrentByte = 0;
mCurrentBit = 0;
mOwner = pOwner;
CC_SAFE_RETAIN(mOwner);
_data = pData;
CC_SAFE_RETAIN(_data);
_bytes =_data->getBytes();
_currentByte = 0;
_currentBit = 0;
_owner = pOwner;
CC_SAFE_RETAIN(_owner);
mActionManager->setRootContainerSize(parentSize);
mActionManager->mOwner = mOwner;
mOwnerOutletNodes = new Array();
mOwnerCallbackNodes = new Array();
_actionManager->setRootContainerSize(parentSize);
_actionManager->_owner = _owner;
_ownerOutletNodes = new Array();
_ownerCallbackNodes = new Array();
Dictionary* animationManagers = Dictionary::create();
Node *pNodeGraph = readFileWithCleanUp(true, animationManagers);
if (pNodeGraph && mActionManager->getAutoPlaySequenceId() != -1 && !_jsControlled)
if (pNodeGraph && _actionManager->getAutoPlaySequenceId() != -1 && !_jsControlled)
{
// Auto play animations
mActionManager->runAnimationsForSequenceIdTweenDuration(mActionManager->getAutoPlaySequenceId(), 0);
_actionManager->runAnimationsForSequenceIdTweenDuration(_actionManager->getAutoPlaySequenceId(), 0);
}
// Assign actionManagers to userObject
if(_jsControlled) {
mNodesWithAnimationManagers = new Array();
mAnimationManagersForNodes = new Array();
_nodesWithAnimationManagers = new Array();
_animationManagersForNodes = new Array();
}
DictElement* pElement = NULL;
@ -295,8 +295,8 @@ Node* CCBReader::readNodeGraphFromData(Data *pData, Object *pOwner, const Size &
if (_jsControlled)
{
mNodesWithAnimationManagers->addObject(pNode);
mAnimationManagersForNodes->addObject(manager);
_nodesWithAnimationManagers->addObject(pNode);
_animationManagersForNodes->addObject(manager);
}
}
@ -354,7 +354,7 @@ Node* CCBReader::readFileWithCleanUp(bool bCleanUp, Dictionary* am)
Node *pNode = readNodeGraph(NULL);
mActionManagers->setObject(mActionManager, intptr_t(pNode));
_actionManagers->setObject(_actionManager, intptr_t(pNode));
if (bCleanUp)
{
@ -368,7 +368,7 @@ bool CCBReader::readStringCache() {
int numStrings = this->readInt(false);
for(int i = 0; i < numStrings; i++) {
this->mStringCache.push_back(this->readUTF8());
this->_stringCache.push_back(this->readUTF8());
}
return true;
@ -377,13 +377,13 @@ bool CCBReader::readStringCache() {
bool CCBReader::readHeader()
{
/* If no bytes loaded, don't crash about it. */
if(this->mBytes == NULL) {
if(this->_bytes == NULL) {
return false;
}
/* Read magic bytes */
int magicBytes = *((int*)(this->mBytes + this->mCurrentByte));
this->mCurrentByte += 4;
int magicBytes = *((int*)(this->_bytes + this->_currentByte));
this->_currentByte += 4;
if(CC_SWAP_INT32_LITTLE_TO_HOST(magicBytes) != 'ccbi') {
return false;
@ -398,15 +398,15 @@ bool CCBReader::readHeader()
// Read JS check
_jsControlled = this->readBool();
mActionManager->_jsControlled = _jsControlled;
_actionManager->_jsControlled = _jsControlled;
return true;
}
unsigned char CCBReader::readByte()
{
unsigned char byte = this->mBytes[this->mCurrentByte];
this->mCurrentByte++;
unsigned char byte = this->_bytes[this->_currentByte];
this->_currentByte++;
return byte;
}
@ -425,39 +425,39 @@ std::string CCBReader::readUTF8()
int numBytes = b0 << 8 | b1;
char* pStr = (char*)malloc(numBytes+1);
memcpy(pStr, mBytes+mCurrentByte, numBytes);
memcpy(pStr, _bytes+_currentByte, numBytes);
pStr[numBytes] = '\0';
ret = pStr;
free(pStr);
mCurrentByte += numBytes;
_currentByte += numBytes;
return ret;
}
bool CCBReader::getBit() {
bool bit;
unsigned char byte = *(this->mBytes + this->mCurrentByte);
if(byte & (1 << this->mCurrentBit)) {
unsigned char byte = *(this->_bytes + this->_currentByte);
if(byte & (1 << this->_currentBit)) {
bit = true;
} else {
bit = false;
}
this->mCurrentBit++;
this->_currentBit++;
if(this->mCurrentBit >= 8) {
this->mCurrentBit = 0;
this->mCurrentByte++;
if(this->_currentBit >= 8) {
this->_currentBit = 0;
this->_currentByte++;
}
return bit;
}
void CCBReader::alignBits() {
if(this->mCurrentBit) {
this->mCurrentBit = 0;
this->mCurrentByte++;
if(this->_currentBit) {
this->_currentBit = 0;
this->_currentByte++;
}
}
@ -515,7 +515,7 @@ float CCBReader::readFloat()
/* using a memcpy since the compiler isn't
* doing the float ptr math correctly on device.
* TODO still applies in C++ ? */
unsigned char* pF = (this->mBytes + this->mCurrentByte);
unsigned char* pF = (this->_bytes + this->_currentByte);
float f = 0;
// N.B - in order to avoid an unaligned memory access crash on 'memcpy()' the the (void*) casts of the source and
@ -531,7 +531,7 @@ float CCBReader::readFloat()
// http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka3934.html
memcpy((void*) &f, (const void*) pF, sizeof(float));
this->mCurrentByte += sizeof(float);
this->_currentByte += sizeof(float);
return f;
}
}
@ -540,7 +540,7 @@ float CCBReader::readFloat()
std::string CCBReader::readCachedString()
{
int n = this->readInt(false);
return this->mStringCache[n];
return this->_stringCache[n];
}
Node * CCBReader::readNodeGraph(Node * pParent)
@ -562,7 +562,7 @@ Node * CCBReader::readNodeGraph(Node * pParent)
memberVarAssignmentName = this->readCachedString();
}
NodeLoader *ccNodeLoader = this->mNodeLoaderLibrary->getNodeLoader(className.c_str());
NodeLoader *ccNodeLoader = this->_nodeLoaderLibrary->getNodeLoader(className.c_str());
if (! ccNodeLoader)
{
@ -573,20 +573,20 @@ Node * CCBReader::readNodeGraph(Node * pParent)
Node *node = ccNodeLoader->loadNode(pParent, this);
// Set root node
if (! mActionManager->getRootNode())
if (! _actionManager->getRootNode())
{
mActionManager->setRootNode(node);
_actionManager->setRootNode(node);
}
// Assign controller
if(_jsControlled && node == mActionManager->getRootNode())
if(_jsControlled && node == _actionManager->getRootNode())
{
mActionManager->setDocumentControllerName(_jsControlledName);
_actionManager->setDocumentControllerName(_jsControlledName);
}
// Read animated properties
Dictionary *seqs = Dictionary::create();
mAnimatedProps = new set<string>();
_animatedProps = new set<string>();
int numSequence = readInt(false);
for (int i = 0; i < numSequence; ++i)
@ -603,7 +603,7 @@ Node * CCBReader::readNodeGraph(Node * pParent)
seqProp->setName(readCachedString().c_str());
seqProp->setType(readInt(false));
mAnimatedProps->insert(seqProp->getName());
_animatedProps->insert(seqProp->getName());
int numKeyframes = readInt(false);
@ -622,7 +622,7 @@ Node * CCBReader::readNodeGraph(Node * pParent)
if (seqs->count() > 0)
{
mActionManager->addNode(node, seqs);
_actionManager->addNode(node, seqs);
}
// Read properties
@ -643,7 +643,7 @@ Node * CCBReader::readNodeGraph(Node * pParent)
embeddedNode->setVisible(true);
//embeddedNode->ignoreAnchorPointForPosition(ccbFileNode->isIgnoreAnchorPointForPosition());
mActionManager->moveAnimationsFromNode(ccbFileNode, embeddedNode);
_actionManager->moveAnimationsFromNode(ccbFileNode, embeddedNode);
ccbFileNode->setCCBFileNode(NULL);
@ -664,11 +664,11 @@ Node * CCBReader::readNodeGraph(Node * pParent)
Object * target = NULL;
if(memberVarAssignmentType == TargetType::DOCUMENT_ROOT)
{
target = mActionManager->getRootNode();
target = _actionManager->getRootNode();
}
else if(memberVarAssignmentType == TargetType::OWNER)
{
target = this->mOwner;
target = this->_owner;
}
if(target != NULL)
@ -683,9 +683,9 @@ Node * CCBReader::readNodeGraph(Node * pParent)
assigned = targetAsCCBMemberVariableAssigner->onAssignCCBMemberVariable(target, memberVarAssignmentName.c_str(), node);
}
if(!assigned && this->mCCBMemberVariableAssigner != NULL)
if(!assigned && this->_CCBMemberVariableAssigner != NULL)
{
assigned = this->mCCBMemberVariableAssigner->onAssignCCBMemberVariable(target, memberVarAssignmentName.c_str(), node);
assigned = this->_CCBMemberVariableAssigner->onAssignCCBMemberVariable(target, memberVarAssignmentName.c_str(), node);
}
}
}
@ -694,13 +694,13 @@ Node * CCBReader::readNodeGraph(Node * pParent)
{
if(memberVarAssignmentType == TargetType::DOCUMENT_ROOT)
{
mActionManager->addDocumentOutletName(memberVarAssignmentName);
mActionManager->addDocumentOutletNode(node);
_actionManager->addDocumentOutletName(memberVarAssignmentName);
_actionManager->addDocumentOutletNode(node);
}
else
{
mOwnerOutletNames.push_back(memberVarAssignmentName);
mOwnerOutletNodes->addObject(node);
_ownerOutletNames.push_back(memberVarAssignmentName);
_ownerOutletNodes->addObject(node);
}
}
}
@ -724,9 +724,9 @@ Node * CCBReader::readNodeGraph(Node * pParent)
{
customAssigned = targetAsCCBMemberVariableAssigner->onAssignCCBCustomProperty(target, pElement->getStrKey(), static_cast<CCBValue*>(pElement->getObject()));
if(!customAssigned && this->mCCBMemberVariableAssigner != NULL)
if(!customAssigned && this->_CCBMemberVariableAssigner != NULL)
{
customAssigned = this->mCCBMemberVariableAssigner->onAssignCCBCustomProperty(target, pElement->getStrKey(), static_cast<CCBValue*>(pElement->getObject()));
customAssigned = this->_CCBMemberVariableAssigner->onAssignCCBCustomProperty(target, pElement->getStrKey(), static_cast<CCBValue*>(pElement->getObject()));
}
}
}
@ -736,8 +736,8 @@ Node * CCBReader::readNodeGraph(Node * pParent)
#endif // CCB_ENABLE_JAVASCRIPT
delete mAnimatedProps;
mAnimatedProps = NULL;
delete _animatedProps;
_animatedProps = NULL;
/* Read and add children. */
int numChildren = this->readInt(false);
@ -754,8 +754,8 @@ Node * CCBReader::readNodeGraph(Node * pParent)
NodeLoaderListener * nodeAsNodeLoaderListener = dynamic_cast<NodeLoaderListener *>(node);
if(nodeAsNodeLoaderListener != NULL) {
nodeAsNodeLoaderListener->onNodeLoaded(node, ccNodeLoader);
} else if(this->mNodeLoaderListener != NULL) {
this->mNodeLoaderListener->onNodeLoaded(node, ccNodeLoader);
} else if(this->_nodeLoaderListener != NULL) {
this->_nodeLoaderListener->onNodeLoaded(node, ccNodeLoader);
}
}
return node;
@ -824,7 +824,7 @@ CCBKeyframe* CCBReader::readKeyframe(PropertyType type)
if (spriteSheet.length() == 0)
{
spriteFile = mCCBRootPath + spriteFile;
spriteFile = _CCBRootPath + spriteFile;
Texture2D *texture = TextureCache::getInstance()->addImage(spriteFile.c_str());
Rect bounds = Rect(0, 0, texture->getContentSize().width, texture->getContentSize().height);
@ -833,14 +833,14 @@ CCBKeyframe* CCBReader::readKeyframe(PropertyType type)
}
else
{
spriteSheet = mCCBRootPath + spriteSheet;
spriteSheet = _CCBRootPath + spriteSheet;
SpriteFrameCache* frameCache = SpriteFrameCache::getInstance();
// Load the sprite sheet only if it is not loaded
if (mLoadedSpriteSheets.find(spriteSheet) == mLoadedSpriteSheets.end())
if (_loadedSpriteSheets.find(spriteSheet) == _loadedSpriteSheets.end())
{
frameCache->addSpriteFramesWithFile(spriteSheet.c_str());
mLoadedSpriteSheets.insert(spriteSheet);
_loadedSpriteSheets.insert(spriteSheet);
}
spriteFrame = frameCache->getSpriteFrameByName(spriteFile.c_str());
@ -881,7 +881,7 @@ bool CCBReader::readCallbackKeyframesForSeq(CCBSequence* seq)
if(_jsControlled) {
string callbackIdentifier;
mActionManager->getKeyframeCallbacks()->addObject(String::createWithFormat("%d:%s",callbackType, callbackName.c_str()));
_actionManager->getKeyframeCallbacks()->addObject(String::createWithFormat("%d:%s",callbackType, callbackName.c_str()));
}
channel->getKeyframes()->addObject(keyframe);
@ -933,7 +933,7 @@ Node * CCBReader::readNodeGraph() {
bool CCBReader::readSequences()
{
Array *sequences = mActionManager->getSequences();
Array *sequences = _actionManager->getSequences();
int numSeqs = readInt(false);
@ -953,7 +953,7 @@ bool CCBReader::readSequences()
sequences->addObject(seq);
}
mActionManager->setAutoPlaySequenceId(readInt(true));
_actionManager->setAutoPlaySequenceId(readInt(true));
return true;
}
@ -996,27 +996,27 @@ bool CCBReader::isJSControlled() {
}
void CCBReader::addOwnerCallbackName(std::string name) {
mOwnerCallbackNames.push_back(name);
_ownerCallbackNames.push_back(name);
}
void CCBReader::addOwnerCallbackNode(Node *node) {
mOwnerCallbackNodes->addObject(node);
_ownerCallbackNodes->addObject(node);
}
void CCBReader::addDocumentCallbackName(std::string name) {
mActionManager->addDocumentCallbackName(name);
_actionManager->addDocumentCallbackName(name);
}
void CCBReader::addDocumentCallbackNode(Node *node) {
mActionManager->addDocumentCallbackNode(node);
_actionManager->addDocumentCallbackNode(node);
}
Array* CCBReader::getOwnerCallbackNames() {
Array* pRet = Array::createWithCapacity(mOwnerCallbackNames.size());
std::vector<std::string>::iterator it = mOwnerCallbackNames.begin();
for (; it != mOwnerCallbackNames.end(); ++it)
Array* pRet = Array::createWithCapacity(_ownerCallbackNames.size());
std::vector<std::string>::iterator it = _ownerCallbackNames.begin();
for (; it != _ownerCallbackNames.end(); ++it)
{
pRet->addObject(String::create(*it));
}
@ -1025,13 +1025,13 @@ Array* CCBReader::getOwnerCallbackNames() {
}
Array* CCBReader::getOwnerCallbackNodes() {
return mOwnerCallbackNodes;
return _ownerCallbackNodes;
}
Array* CCBReader::getOwnerOutletNames() {
Array* pRet = Array::createWithCapacity(mOwnerOutletNames.size());
std::vector<std::string>::iterator it = mOwnerOutletNames.begin();
for (; it != mOwnerOutletNames.end(); ++it)
Array* pRet = Array::createWithCapacity(_ownerOutletNames.size());
std::vector<std::string>::iterator it = _ownerOutletNames.begin();
for (; it != _ownerOutletNames.end(); ++it)
{
pRet->addObject(String::create(*it));
}
@ -1039,20 +1039,20 @@ Array* CCBReader::getOwnerOutletNames() {
}
Array* CCBReader::getOwnerOutletNodes() {
return mOwnerOutletNodes;
return _ownerOutletNodes;
}
Array* CCBReader::getNodesWithAnimationManagers() {
return mNodesWithAnimationManagers;
return _nodesWithAnimationManagers;
}
Array* CCBReader::getAnimationManagersForNodes() {
return mAnimationManagersForNodes;
return _animationManagersForNodes;
}
void CCBReader::addOwnerOutletName(std::string name)
{
mOwnerOutletNames.push_back(name);
_ownerOutletNames.push_back(name);
}
void CCBReader::addOwnerOutletNode(Node *node)
@ -1060,7 +1060,7 @@ void CCBReader::addOwnerOutletNode(Node *node)
if (NULL != node)
return;
mOwnerOutletNodes->addObject(node);
_ownerOutletNodes->addObject(node);
}
/************************************************************************

View File

@ -40,7 +40,7 @@ NS_CC_EXT_BEGIN
class CCBFile : public Node
{
private:
Node *mCCBFileNode;
Node *_CCBFileNode;
public:
CCBFile();
@ -149,7 +149,7 @@ public:
virtual ~CCBReader();
CCBReader();
void setCCBRootPath(const char* pCCBRootPath);
void setCCBRootPath(const char* ccbRootPath);
const std::string& getCCBRootPath() const;
Node* readNodeGraphFromFile(const char *pCCBFileName);
@ -235,38 +235,38 @@ private:
friend class NodeLoader;
private:
Data *mData;
unsigned char *mBytes;
int mCurrentByte;
int mCurrentBit;
Data *_data;
unsigned char *_bytes;
int _currentByte;
int _currentBit;
std::vector<std::string> mStringCache;
std::set<std::string> mLoadedSpriteSheets;
std::vector<std::string> _stringCache;
std::set<std::string> _loadedSpriteSheets;
Object *mOwner;
Object *_owner;
CCBAnimationManager *mActionManager; //retain
Dictionary* mActionManagers;
CCBAnimationManager *_actionManager; //retain
Dictionary* _actionManagers;
std::set<std::string> *mAnimatedProps;
std::set<std::string> *_animatedProps;
NodeLoaderLibrary *mNodeLoaderLibrary;
NodeLoaderListener *mNodeLoaderListener;
CCBMemberVariableAssigner *mCCBMemberVariableAssigner;
CCBSelectorResolver *mCCBSelectorResolver;
NodeLoaderLibrary *_nodeLoaderLibrary;
NodeLoaderListener *_nodeLoaderListener;
CCBMemberVariableAssigner *_CCBMemberVariableAssigner;
CCBSelectorResolver *_CCBSelectorResolver;
std::vector<std::string> mOwnerOutletNames;
Array* mOwnerOutletNodes;
Array* mNodesWithAnimationManagers;
Array* mAnimationManagersForNodes;
std::vector<std::string> _ownerOutletNames;
Array* _ownerOutletNodes;
Array* _nodesWithAnimationManagers;
Array* _animationManagersForNodes;
std::vector<std::string> mOwnerCallbackNames;
Array* mOwnerCallbackNodes;
std::string mCCBRootPath;
std::vector<std::string> _ownerCallbackNames;
Array* _ownerCallbackNodes;
std::string _CCBRootPath;
bool _jsControlled;
bool hasScriptingOwner;
bool _hasScriptingOwner;
bool init();
};

View File

@ -7,8 +7,8 @@ using namespace std;
NS_CC_EXT_BEGIN
CCBSequence::CCBSequence()
: mDuration(0.0f)
, mName("")
: _duration(0.0f)
, _name("")
, mSequenceId(0)
, mChainedSequenceId(0)
, mCallbackChannel(NULL)
@ -22,22 +22,22 @@ CCBSequence::~CCBSequence() {
float CCBSequence::getDuration()
{
return mDuration;
return _duration;
}
void CCBSequence::setDuration(float fDuration)
{
mDuration = fDuration;
_duration = fDuration;
}
const char* CCBSequence::getName()
{
return mName.c_str();
return _name.c_str();
}
void CCBSequence::setName(const char *pName)
{
mName = pName;
_name = pName;
}
int CCBSequence::getSequenceId()

View File

@ -10,14 +10,6 @@ NS_CC_EXT_BEGIN
class CCBSequence : public Object
{
private:
float mDuration;
std::string mName;
int mSequenceId;
int mChainedSequenceId;
CCBSequenceProperty* mCallbackChannel;
CCBSequenceProperty* mSoundChannel;
public:
CCBSequence();
~CCBSequence();
@ -38,6 +30,14 @@ public:
int getChainedSequenceId();
void setChainedSequenceId(int nChainedSequenceId);
private:
float _duration;
std::string _name;
int mSequenceId;
int mChainedSequenceId;
CCBSequenceProperty* mCallbackChannel;
CCBSequenceProperty* mSoundChannel;
};

View File

@ -6,47 +6,47 @@ using namespace std;
NS_CC_EXT_BEGIN
CCBSequenceProperty::CCBSequenceProperty()
: mName("")
, mType(0)
: _name("")
, _type(0)
{
init();
}
bool CCBSequenceProperty::init()
{
mKeyframes = new Array();
_keyframes = new Array();
return true;
}
CCBSequenceProperty::~CCBSequenceProperty()
{
CC_SAFE_RELEASE_NULL(mKeyframes);
CC_SAFE_RELEASE_NULL(_keyframes);
}
const char* CCBSequenceProperty::getName()
{
return mName.c_str();
return _name.c_str();
}
void CCBSequenceProperty::setName(const char *pName)
{
mName = pName;
_name = pName;
}
int CCBSequenceProperty::getType()
{
return mType;
return _type;
}
void CCBSequenceProperty::setType(int type)
{
mType = type;
_type = type;
}
Array* CCBSequenceProperty::getKeyframes()
{
return mKeyframes;
return _keyframes;
}
NS_CC_EXT_END

View File

@ -9,11 +9,6 @@ NS_CC_EXT_BEGIN
class CCBSequenceProperty : public Object
{
private:
std::string mName;
int mType;
Array *mKeyframes;
public:
CCBSequenceProperty();
~CCBSequenceProperty();
@ -27,6 +22,11 @@ public:
void setType(int type);
Array* getKeyframes();
private:
std::string _name;
int _type;
Array *_keyframes;
};
NS_CC_EXT_END

View File

@ -33,8 +33,8 @@ CCBValue* CCBValue::create(int nValue)
CCBValue *ret = new CCBValue();
if (ret)
{
ret->mValue.nValue = nValue;
ret->mType = TYPE_INT;
ret->_value.intValue = nValue;
ret->_type = TYPE_INT;
ret->autorelease();
}
@ -46,8 +46,8 @@ CCBValue* CCBValue::create(float fValue)
CCBValue *ret = new CCBValue();
if (ret)
{
ret->mValue.fValue = fValue;
ret->mType = TYPE_FLOAT;
ret->_value.floatValue = fValue;
ret->_type = TYPE_FLOAT;
ret->autorelease();
}
@ -59,8 +59,8 @@ CCBValue* CCBValue::create(bool vValue)
CCBValue *ret = new CCBValue();
if (ret)
{
ret->mValue.nValue = vValue ? 1 : 0;
ret->mType = TYPE_BOOL;
ret->_value.intValue = vValue ? 1 : 0;
ret->_type = TYPE_BOOL;
ret->autorelease();
}
@ -72,8 +72,8 @@ CCBValue* CCBValue::create(unsigned char byte)
CCBValue *ret = new CCBValue();
if (ret)
{
ret->mValue.nValue = byte;
ret->mType = TYPE_UNSIGNED_CHAR;
ret->_value.intValue = byte;
ret->_type = TYPE_UNSIGNED_CHAR;
ret->autorelease();
}
@ -85,8 +85,8 @@ CCBValue* CCBValue::create(const char *pStringValue)
CCBValue *ret = new CCBValue();
if (ret)
{
ret->_value = pStringValue;
ret->mType = TYPE_STRING;
ret->_strValue = pStringValue;
ret->_type = TYPE_STRING;
ret->autorelease();
}
@ -100,7 +100,7 @@ CCBValue* CCBValue::create(Array *pArrValue)
if (ret)
{
ret->_arrValue = pArrValue;
ret->mType = TYPE_ARRAY;
ret->_type = TYPE_ARRAY;
ret->autorelease();
}
@ -110,35 +110,35 @@ CCBValue* CCBValue::create(Array *pArrValue)
int CCBValue::getIntValue()
{
CCASSERT(mType == TYPE_INT, "The type of CCBValue isn't integer.");
CCASSERT(_type == TYPE_INT, "The type of CCBValue isn't integer.");
return mValue.nValue;
return _value.intValue;
}
float CCBValue::getFloatValue()
{
CCASSERT(mType == TYPE_FLOAT, "The type of CCBValue isn't float.");
CCASSERT(_type == TYPE_FLOAT, "The type of CCBValue isn't float.");
return mValue.fValue;
return _value.floatValue;
}
bool CCBValue::getBoolValue()
{
CCASSERT(mType == TYPE_BOOL, "The type of CCBValue isn't boolean.");
CCASSERT(_type == TYPE_BOOL, "The type of CCBValue isn't boolean.");
return mValue.nValue == 1 ? true : false;
return _value.intValue == 1 ? true : false;
}
unsigned char CCBValue::getByteValue()
{
CCASSERT(mType == TYPE_UNSIGNED_CHAR, "The type of CCBValue isn't unsigned char.");
CCASSERT(_type == TYPE_UNSIGNED_CHAR, "The type of CCBValue isn't unsigned char.");
return (unsigned char)(mValue.nValue);
return (unsigned char)(_value.intValue);
}
Array* CCBValue::getArrayValue()
{
CCASSERT(mType == TYPE_ARRAY, "The type of CCBValue isn't array.");
CCASSERT(_type == TYPE_ARRAY, "The type of CCBValue isn't array.");
return _arrValue;
}
@ -146,14 +146,14 @@ Array* CCBValue::getArrayValue()
const char* CCBValue::getStringValue()
{
CCASSERT(mType == TYPE_STRING, "The type of CCBValue isn't string.");
CCASSERT(_type == TYPE_STRING, "The type of CCBValue isn't string.");
return _value.c_str();
return _strValue.c_str();
}
CCBValue::Type CCBValue::getType()
{
return mType;
return _type;
}
NS_CC_EXT_END

View File

@ -12,13 +12,13 @@ NS_CC_EXT_BEGIN
class Color3BWapper : public Object
{
private:
Color3B color;
public:
static Color3BWapper* create(const Color3B& color);
const Color3B& getColor() const;
private:
Color3B color;
};
@ -57,13 +57,13 @@ public:
private:
union
{
int nValue;
float fValue;
} mValue;
int intValue;
float floatValue;
} _value;
std::string _value;
std::string _strValue;
Array* _arrValue;
Type mType;
Type _type;
};
NS_CC_EXT_END

View File

@ -917,22 +917,22 @@ Node * NodeLoader::parsePropTypeCCBFile(Node * pNode, Node * pParent, CCBReader
CC_SAFE_DELETE_ARRAY(pBytes);
data->retain();
reader->mData = data;
reader->mBytes = data->getBytes();
reader->mCurrentByte = 0;
reader->mCurrentBit = 0;
CC_SAFE_RETAIN(pCCBReader->mOwner);
reader->mOwner = pCCBReader->mOwner;
reader->_data = data;
reader->_bytes = data->getBytes();
reader->_currentByte = 0;
reader->_currentBit = 0;
CC_SAFE_RETAIN(pCCBReader->_owner);
reader->_owner = pCCBReader->_owner;
reader->getAnimationManager()->mOwner = reader->mOwner;
reader->getAnimationManager()->_owner = reader->_owner;
// The assignments below are done in the CCBReader constructor.
// reader->mOwnerOutletNames = pCCBReader->mOwnerOutletNames;
// reader->mOwnerOutletNodes = pCCBReader->mOwnerOutletNodes;
// reader->mOwnerOutletNodes->retain();
// reader->mOwnerCallbackNames = pCCBReader->mOwnerCallbackNames;
// reader->mOwnerCallbackNodes = pCCBReader->mOwnerCallbackNodes;
// reader->mOwnerCallbackNodes->retain();
// reader->_ownerOutletNames = pCCBReader->_ownerOutletNames;
// reader->_ownerOutletNodes = pCCBReader->_ownerOutletNodes;
// reader->_ownerOutletNodes->retain();
// reader->_ownerCallbackNames = pCCBReader->_ownerCallbackNames;
// reader->_ownerCallbackNodes = pCCBReader->_ownerCallbackNodes;
// reader->_ownerCallbackNodes->retain();
data->release();
@ -944,7 +944,7 @@ Node * NodeLoader::parsePropTypeCCBFile(Node * pNode, Node * pParent, CCBReader
reader->getAnimationManager()->runAnimationsForSequenceIdTweenDuration(reader->getAnimationManager()->getAutoPlaySequenceId(), 0);
}
if (reader->isJSControlled() && pCCBReader->isJSControlled() && NULL != reader->mOwner)
if (reader->isJSControlled() && pCCBReader->isJSControlled() && NULL != reader->_owner)
{
//set variables and callback to owner
//set callback

View File

@ -46,15 +46,15 @@ void NodeLoaderLibrary::registerDefaultNodeLoaders() {
void NodeLoaderLibrary::registerNodeLoader(const char * pClassName, NodeLoader * pNodeLoader) {
pNodeLoader->retain();
this->mNodeLoaders.insert(NodeLoaderMapEntry(pClassName, pNodeLoader));
this->_nodeLoaders.insert(NodeLoaderMapEntry(pClassName, pNodeLoader));
}
void NodeLoaderLibrary::unregisterNodeLoader(const char * pClassName) {
NodeLoaderMap::iterator ccNodeLoadersIterator = this->mNodeLoaders.find(pClassName);
if (ccNodeLoadersIterator != this->mNodeLoaders.end())
NodeLoaderMap::iterator ccNodeLoadersIterator = this->_nodeLoaders.find(pClassName);
if (ccNodeLoadersIterator != this->_nodeLoaders.end())
{
ccNodeLoadersIterator->second->release();
mNodeLoaders.erase(ccNodeLoadersIterator);
_nodeLoaders.erase(ccNodeLoadersIterator);
}
else
{
@ -63,18 +63,18 @@ void NodeLoaderLibrary::unregisterNodeLoader(const char * pClassName) {
}
NodeLoader * NodeLoaderLibrary::getNodeLoader(const char* pClassName) {
NodeLoaderMap::iterator ccNodeLoadersIterator = this->mNodeLoaders.find(pClassName);
assert(ccNodeLoadersIterator != this->mNodeLoaders.end());
NodeLoaderMap::iterator ccNodeLoadersIterator = this->_nodeLoaders.find(pClassName);
assert(ccNodeLoadersIterator != this->_nodeLoaders.end());
return ccNodeLoadersIterator->second;
}
void NodeLoaderLibrary::purge(bool pReleaseNodeLoaders) {
if(pReleaseNodeLoaders) {
for(NodeLoaderMap::iterator it = this->mNodeLoaders.begin(); it != this->mNodeLoaders.end(); it++) {
for(NodeLoaderMap::iterator it = this->_nodeLoaders.begin(); it != this->_nodeLoaders.end(); it++) {
it->second->release();
}
}
this->mNodeLoaders.clear();
this->_nodeLoaders.clear();
}

View File

@ -11,10 +11,8 @@ class NodeLoader;
typedef std::map<std::string, NodeLoader *> NodeLoaderMap;
typedef std::pair<std::string, NodeLoader *> NodeLoaderMapEntry;
class NodeLoaderLibrary : public Object {
private:
NodeLoaderMap mNodeLoaders;
class NodeLoaderLibrary : public Object
{
public:
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(NodeLoaderLibrary, library);
@ -45,6 +43,9 @@ public:
CC_DEPRECATED_ATTRIBUTE static void purgeSharedNodeLoaderLibrary() { NodeLoaderLibrary::destroyInstance(); };
CC_DEPRECATED_ATTRIBUTE static NodeLoaderLibrary * newDefaultCCNodeLoaderLibrary() { return NodeLoaderLibrary::newDefaultNodeLoaderLibrary(); };
private:
NodeLoaderMap _nodeLoaders;
};
NS_CC_EXT_END