void AnimationCommandLayer::onFrameEvent(Frame * frame)
	{

		EventFrame* evnt = dynamic_cast<EventFrame*>(frame);
		std::string aniStr = evnt->getEvent();

		if (!evnt)
		{
			return;
		}

		Sprite* sp = (Sprite*)evnt->getNode();
		if (aniStr != "")//spine动画 compare(0, 3, "spi")
		{
			Player * player = (Player *)sp->getChildByTag(SPINE_ANIMATION_PLAYER_TAG);
			player->playRoleAction(aniStr.c_str(), true);
			CCLOG("%s Spine Animation is %s", player->getName().c_str(), aniStr.c_str());
		}
//暂时去掉下面的代码,如果以后需要执行cocos studio做不出来的动画,那么修改规则,用下面的代码 cuihanbing
// 		else if (str.compare(0, 3, "act") == 0)//需要cocos2d执行的动画
// 		{
// 			if (str == "act_chuxian")
// 			{
// 				evnt->getNode()->setOpacity(256);
// 				CCLOG("Action is %s", str.c_str());
// 			}
// 		}
	}
Ejemplo n.º 2
0
void TestTimelineFrameEvent::onFrameEvent(Frame* frame)
{
    EventFrame* evnt = dynamic_cast<EventFrame*>(frame);
    if(!evnt)
        return;

    std::string str = evnt->getEvent();

    if (str == "changeColor")
    {
        evnt->getNode()->setColor(Color3B(0,0,0));
    }
    else if(str == "endChangeColor")
    {
        evnt->getNode()->setColor(Color3B(255,255,255));
    }
}