void TextureCache::checkRepeatTexture() { std::map< string, vector<string>> maps; for (auto it = this->_textures.begin(); it != this->_textures.end(); it++) { string key = it->first; TexInfo* info = it->second; string fileFullPath = info->Tex->getPath(); if (!fileFullPath.empty()) { if (maps.find(fileFullPath) == maps.end()) { maps[fileFullPath] = { key }; } else{ // repeat texture maps[fileFullPath].push_back(key); } } } std::map< string, vector<string>> repeatInfo; for (auto map : maps) { if (map.second.size() > 1) { repeatInfo[map.first] = map.second; } } int size = repeatInfo.size(); if (size > 0) { cocos2d::log("\nrepead count: %d", size); for (auto info : repeatInfo) { cocos2d::log("\n[%d] file:%s", info.second.size(), info.first.c_str()); for (auto item : info.second) { cocos2d::log("-> %s", item.c_str()); } cocos2d::log("\n"); } cocos2d::log("\n"); } } 复制代码