2012-09-17 18:49:05 +08:00
|
|
|
#include "AnimationsTestLayer.h"
|
|
|
|
|
|
|
|
USING_NS_CC;
|
|
|
|
USING_NS_CC_EXT;
|
2013-10-15 18:00:03 +08:00
|
|
|
using namespace cocosbuilder;
|
2012-09-17 18:49:05 +08:00
|
|
|
|
|
|
|
AnimationsTestLayer::AnimationsTestLayer()
|
2014-04-09 22:53:59 +08:00
|
|
|
: mAnimationManager(nullptr)
|
2012-09-17 18:49:05 +08:00
|
|
|
{}
|
|
|
|
|
|
|
|
AnimationsTestLayer::~AnimationsTestLayer()
|
|
|
|
{
|
|
|
|
CC_SAFE_RELEASE_NULL(mAnimationManager);
|
|
|
|
}
|
|
|
|
|
2014-02-20 10:53:49 +08:00
|
|
|
SEL_MenuHandler AnimationsTestLayer::onResolveCCBCCMenuItemSelector(Ref * pTarget, const char * pSelectorName)
|
2012-09-17 18:49:05 +08:00
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-02-20 10:53:49 +08:00
|
|
|
Control::Handler AnimationsTestLayer::onResolveCCBCCControlSelector(Ref *pTarget, const char*pSelectorName)
|
2013-07-27 21:44:49 +08:00
|
|
|
{
|
|
|
|
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);
|
2012-09-17 18:49:05 +08:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-02-20 10:53:49 +08:00
|
|
|
bool AnimationsTestLayer::onAssignCCBMemberVariable(Ref * pTarget, const char * pMemberVariableName, Node * pNode) {
|
2012-09-17 18:49:05 +08:00
|
|
|
CCB_MEMBERVARIABLEASSIGNER_GLUE(this, "mAnimationManager", CCBAnimationManager *, this->mAnimationManager);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-10-15 18:00:03 +08:00
|
|
|
void AnimationsTestLayer::setAnimationManager(cocosbuilder::CCBAnimationManager *pAnimationManager)
|
2012-09-17 18:49:05 +08:00
|
|
|
{
|
|
|
|
CC_SAFE_RELEASE_NULL(mAnimationManager);
|
|
|
|
mAnimationManager = pAnimationManager;
|
|
|
|
CC_SAFE_RETAIN(mAnimationManager);
|
|
|
|
}
|
|
|
|
|
2014-02-20 10:53:49 +08:00
|
|
|
void AnimationsTestLayer::onControlButtonIdleClicked(Ref *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
|
|
|
}
|
|
|
|
|
2014-02-20 10:53:49 +08:00
|
|
|
void AnimationsTestLayer::onControlButtonWaveClicked(Ref *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
|
|
|
}
|
|
|
|
|
2014-02-20 10:53:49 +08:00
|
|
|
void AnimationsTestLayer::onControlButtonJumpClicked(Ref *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
|
|
|
}
|
|
|
|
|
2014-02-20 10:53:49 +08:00
|
|
|
void AnimationsTestLayer::onControlButtonFunkyClicked(Ref *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
|
|
|
}
|