用AnimationCache加载plist文件时,需要用到正面的方法,但是plist里面没有那两个关键词。。。请问什么工具可以生成对这段代码有效的plist呢?
void AnimationCache::addAnimationsWithDictionary(const ValueMap& dictionary,const std::string& plist)
{
if ( dictionary.find(“animations”) == dictionary.end() )
{
CCLOG(“cocos2d: AnimationCache: No animations were found in provided dictionary.”);
return;
}
const Value& animations = dictionary.at("animations");
unsigned int version = 1;
if( dictionary.find("properties") != dictionary.end() )
{
const ValueMap& properties = dictionary.at("properties").asValueMap();
version = properties.at("format").asInt();
const ValueVector& spritesheets = properties.at("spritesheets").asValueVector();
for(const auto &value : spritesheets) {
std::string path = FileUtils::getInstance()->fullPathFromRelativeFile(value.asString(),plist);
SpriteFrameCache::getInstance()->addSpriteFramesWithFile(path);
}
}
switch (version) {
case 1:
parseVersion1(animations.asValueMap());
break;
case 2:
parseVersion2(animations.asValueMap());
break;
default:
CCASSERT(false, "Invalid animation format");
}
}