通过以下代码,可以将ActionTimeline从CSB文件中读取出来
Node* node = CSLoader::createNode("res/unit/goblin/goblin_action.csb");
auto moveNode = node->getChildByName("goblin_attackright");
cocostudio::timeline::ActionTimeline* atl = dynamic_cast<cocostudio::timeline::ActionTimeline*>(moveNode->getActionByTag(moveNode->getTag()));
想请问一下,如何把它加入缓存?
不然的话,每次调用action都要去读取文件,非常麻烦。
类似于下面的方法,直接从缓存中读取action或者animation的话,不需要每次都读取文件。
auto cache = AnimationCache::getInstance();
cache->addAnimationsWithFile("animations/animations-2.plist");
auto animation2 = cache->getAnimation("dance_1");
