本人发现一个BUG
void CCSpriteFrameCache::removeSpriteFramesFromFile(const char* plist)
{
std::string fullPath = CCFileUtils::sharedFileUtils()->fullPathForFilename(plist);
CCDictionary* dict = CCDictionary::createWithContentsOfFileThreadSafe(fullPath.c_str());
removeSpriteFramesFromDictionary((CCDictionary*)dict);
// remove it from the cache
set<string>::iterator ret = m_pLoadedFileNames->find(plist);
if (ret != m_pLoadedFileNames->end())
{
m_pLoadedFileNames->erase(ret);
}
dict->release();
}
其中的find(plist)应该改为fullPath 才对。这样m_pLoadedFileNames移除时才能对应上。
补充一下,通过跟群里高手指点。发现问题是因为
cocos2d::gui::Widget* WidgetPropertiesReader0300::createWidget(const rapidjson::Value& data, const char* fullPath, const char* fileName)
{
m_strFilePath = fullPath;
int texturesCount = DICTOOL->getArrayCount_json(data, "textures");
for (int i=0; i<texturesCount; i++)
{
const char* file = DICTOOL->getStringValueFromArray_json(data, "textures", i);
std::string tp = fullPath;
tp.append(file);
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile(tp.c_str());
}
…}里加载的时候是fullPath。手动清理的时候传入的不是fullPath在此更正。
请管理员删除该贴。