cocos2d/cocos2d-x — pull request #9173 by 2youyouo2 (2014-11-20 02:59:19+00:00)
Title: improve ActionTimeline api

Fow now, the code to create an ActionTimeline and play it is a little complex.

Example:

Node* node = CSLoader::createNode("ActionTimeline/boy_1.csb");
ActionTimeline* action = CSLoader::createTimeline("ActionTimeline/boy_1.csb");

node->runAction(action);
action->gotoFrameAndPlay(0, 60, true);

To get an existing action from node:
ActionTimeline* action = node->getActionByTag(node->getTag());

So we want to make the api more easy to use.
We plain to to create an ActionTimelineNode class, and add some helper api to CSLoader.

ActionTimelineNode wrap the root node and action, we can expend animation api to ActionTimelineNode easily.

ActionTimelineNode will auto create node with action according to the parameters.

static cocostudio::timeline::ActionTimelineNode* createActionTimelineNode(const std::string& filename);
Static cocostudio::timeline::ActionTimelineNode* createActionTimelineNode(const std::string& filename, int startIndex, int endIndex, bool loop);

Example after changed:

ActionTimelineNode*node=CSLoader::createActionTimelineNode("ActionTimeline/boy_1.csb", 0, 60, true);

To get an existing action from node:
ActionTimeline* action = node->getActionTimeline();