mirror of https://github.com/axmolengine/axmol.git
fixed #1277: CCToggleVisibility should implement copyWithZone.
This commit is contained in:
parent
5b4495d982
commit
93d1879a56
|
@ -103,7 +103,7 @@ CCObject* CCShow::copyWithZone(CCZone *pZone) {
|
|||
pZone = pNewZone = new CCZone(pRet);
|
||||
}
|
||||
|
||||
CCFiniteTimeAction::copyWithZone(pZone);
|
||||
CCActionInstant::copyWithZone(pZone);
|
||||
CC_SAFE_DELETE(pNewZone);
|
||||
return pRet;
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ CCObject* CCHide::copyWithZone(CCZone *pZone) {
|
|||
pZone = pNewZone = new CCZone(pRet);
|
||||
}
|
||||
|
||||
CCFiniteTimeAction::copyWithZone(pZone);
|
||||
CCActionInstant::copyWithZone(pZone);
|
||||
CC_SAFE_DELETE(pNewZone);
|
||||
return pRet;
|
||||
}
|
||||
|
@ -149,21 +149,41 @@ CCObject* CCHide::copyWithZone(CCZone *pZone) {
|
|||
//
|
||||
// ToggleVisibility
|
||||
//
|
||||
CCToggleVisibility * CCToggleVisibility::action() {
|
||||
CCToggleVisibility * CCToggleVisibility::action()
|
||||
{
|
||||
CCToggleVisibility *pRet = new CCToggleVisibility();
|
||||
|
||||
if (pRet) {
|
||||
if (pRet)
|
||||
{
|
||||
pRet->autorelease();
|
||||
}
|
||||
|
||||
return pRet;
|
||||
}
|
||||
|
||||
void CCToggleVisibility::update(ccTime time) {
|
||||
void CCToggleVisibility::update(ccTime time)
|
||||
{
|
||||
CC_UNUSED_PARAM(time);
|
||||
m_pTarget->setIsVisible(!m_pTarget->getIsVisible());
|
||||
}
|
||||
|
||||
CCObject* CCToggleVisibility::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone *pNewZone = NULL;
|
||||
CCToggleVisibility *pRet = NULL;
|
||||
|
||||
if (pZone && pZone->m_pCopyObject) {
|
||||
pRet = (CCToggleVisibility*) (pZone->m_pCopyObject);
|
||||
} else {
|
||||
pRet = new CCToggleVisibility();
|
||||
pZone = pNewZone = new CCZone(pRet);
|
||||
}
|
||||
|
||||
CCActionInstant::copyWithZone(pZone);
|
||||
CC_SAFE_DELETE(pNewZone);
|
||||
return pRet;
|
||||
}
|
||||
|
||||
//
|
||||
// FlipX
|
||||
//
|
||||
|
|
|
@ -96,6 +96,7 @@ public:
|
|||
virtual ~CCToggleVisibility(){}
|
||||
//super method
|
||||
virtual void update(ccTime time);
|
||||
virtual CCObject* copyWithZone(CCZone *pZone);
|
||||
public:
|
||||
//override static method
|
||||
/** Allocates and initializes the action */
|
||||
|
|
Loading…
Reference in New Issue