2012-09-17 18:49:05 +08:00
|
|
|
#include "AnimationsTestLayer.h"
|
|
|
|
|
|
|
|
USING_NS_CC;
|
|
|
|
USING_NS_CC_EXT;
|
|
|
|
|
|
|
|
AnimationsTestLayer::AnimationsTestLayer()
|
|
|
|
: mAnimationManager(NULL)
|
|
|
|
{}
|
|
|
|
|
|
|
|
AnimationsTestLayer::~AnimationsTestLayer()
|
|
|
|
{
|
|
|
|
CC_SAFE_RELEASE_NULL(mAnimationManager);
|
|
|
|
}
|
|
|
|
|
2013-07-24 18:17:20 +08:00
|
|
|
SEL_MenuHandler AnimationsTestLayer::onResolveCCBCCMenuItemSelector(Object * pTarget, const char * pSelectorName)
|
2012-09-17 18:49:05 +08:00
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-07-26 15:22:45 +08:00
|
|
|
Control::Handler AnimationsTestLayer::onResolveCCBCCControlSelector(Object *pTarget, const char*pSelectorName) {
|
2013-06-20 14:17:10 +08:00
|
|
|
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);
|
2012-09-17 18:49:05 +08:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
bool AnimationsTestLayer::onAssignCCBMemberVariable(Object * pTarget, const char * pMemberVariableName, Node * pNode) {
|
2012-09-17 18:49:05 +08:00
|
|
|
CCB_MEMBERVARIABLEASSIGNER_GLUE(this, "mAnimationManager", CCBAnimationManager *, this->mAnimationManager);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnimationsTestLayer::setAnimationManager(cocos2d::extension::CCBAnimationManager *pAnimationManager)
|
|
|
|
{
|
|
|
|
CC_SAFE_RELEASE_NULL(mAnimationManager);
|
|
|
|
mAnimationManager = pAnimationManager;
|
|
|
|
CC_SAFE_RETAIN(mAnimationManager);
|
|
|
|
}
|
|
|
|
|
2013-07-26 14:37:26 +08:00
|
|
|
void AnimationsTestLayer::onControlButtonIdleClicked(Object *pSender, Control::EventType pControlEvent) {
|
2012-11-29 18:04:33 +08:00
|
|
|
mAnimationManager->runAnimationsForSequenceNamedTweenDuration("Idle", 0.3f);
|
2012-09-17 18:49:05 +08:00
|
|
|
}
|
|
|
|
|
2013-07-26 14:37:26 +08:00
|
|
|
void AnimationsTestLayer::onControlButtonWaveClicked(Object *pSender, Control::EventType pControlEvent) {
|
2012-11-29 18:04:33 +08:00
|
|
|
mAnimationManager->runAnimationsForSequenceNamedTweenDuration("Wave", 0.3f);
|
2012-09-17 18:49:05 +08:00
|
|
|
}
|
|
|
|
|
2013-07-26 14:37:26 +08:00
|
|
|
void AnimationsTestLayer::onControlButtonJumpClicked(Object *pSender, Control::EventType pControlEvent) {
|
2012-11-29 18:04:33 +08:00
|
|
|
mAnimationManager->runAnimationsForSequenceNamedTweenDuration("Jump", 0.3f);
|
2012-09-17 18:49:05 +08:00
|
|
|
}
|
|
|
|
|
2013-07-26 14:37:26 +08:00
|
|
|
void AnimationsTestLayer::onControlButtonFunkyClicked(Object *pSender, Control::EventType pControlEvent) {
|
2012-11-29 18:04:33 +08:00
|
|
|
mAnimationManager->runAnimationsForSequenceNamedTweenDuration("Funky", 0.3f);
|
2012-09-17 18:49:05 +08:00
|
|
|
}
|