void CCLocalization::addAndroidStrings(const string& lan, const string& path, bool merge) {
    // basic checking
    if(path.empty()) {
        CCLOGWARN("CCLocalization::addAndroidStrings: string file path is empty");
        return;
    }
    if(lan.length() != 2) {
        CCLOGWARN("CCLocalization::addAndroidStrings: language code is not in ISO 639-1 format");
        return;
    }

    // register language dictionary
    CCDictionary* d = (CCDictionary*)m_lanMap.objectForKey(lan);
    if(!d) {
        d = CCDictionary::create();
        m_lanMap.setObject(d, lan);
    }

    // if not merge, clear first
    if(!merge) {
        d->removeAllObjects();
    }

    // parse it
    CCAndroidStringsParser::create()->parse(path, *d);
}
bool GAFAsset::initWithImageData(const std::string& jsonPath)
{
	if (!s3eFileCheckExists(jsonPath.c_str()))
	{
		GAFLOGERROR("CAN NOT create GAFAsset : %s does not exists", jsonPath.c_str());
		return false;
	}
	GAFData aConfigData;
	//std::string fp = CCFileUtils::sharedFileUtils()->fullPathForFilename(jsonPath.c_str());
	std::string fp = jsonPath;
	s3eFile * file = s3eFileOpen (fp.c_str(), "rb");
	if (!file)
	{
		GAFLOGERROR("CAN NOT create GAFAsset : can not open %s.", fp.c_str());
		return false;
	}
	
	aConfigData.setSize(s3eFileGetSize(file));
	aConfigData.setBytes(new unsigned char[aConfigData.size()]);
	s3eFileRead(aConfigData.bytes(), aConfigData.size(), 1, file);
	s3eFileClose(file);
	aConfigData.setDeleteData(true);

	if (!aConfigData.bytes())
	{
		GAFLOGERROR("Can not get data from json file : %s", jsonPath.c_str());
		return NULL;
	}

	if (!aConfigData.bytes())
	{
		GAFLOGWARN("can not init GAFAsset - invalid anImageData");
		return false;
	}
	
	CCDictionary* configDictionary = CCJSONConverter::sharedConverter()->dictionaryFrom( (const char *)aConfigData.bytes());
	
	CCString *versionNode               = (CCString*)configDictionary->objectForKey(kVersionKey);
	
	if (!isAssetVersionPlayable(versionNode->getCString()))
	{
		return false;
	}
	CCArray *animationConfigFrames      = (CCArray *)configDictionary->objectForKey(kAnimationConfigFramesKey);
	CCArray *interactionObjectNodes     = (CCArray *)configDictionary->objectForKey(kInteractionObjectsKey);
	CCArray *standObjectsNodes          = (CCArray *)configDictionary->objectForKey(kStandObjectsKey);
	CCArray *textureAtlasNode           = (CCArray *)configDictionary->objectForKey(kTextureAtlasKey);
	CCArray *animationSequences         = (CCArray *)configDictionary->objectForKey(kAnimationSequencesKey);
	
	CCDictionary *objectNodes           = (CCDictionary *)configDictionary->objectForKey(kAnimationObjectsKey);
	CCDictionary *masksNodes            = (CCDictionary *)configDictionary->objectForKey(kAnimationMasksKey);
	CCDictionary *namedPartsNodes       = (CCDictionary *)configDictionary->objectForKey(kAnimationNamedPartsKey);

	
	if (!animationConfigFrames || !textureAtlasNode|| !objectNodes)
	{
		GAFLOGERROR("Error while creating GAFAsset. Required subnodes in dictionary are missing.");
		return false;
	}
	
	CC_SAFE_RELEASE(_textureAtlas);
	
	if (!textureAtlasNode->count())
	{
		return false;
	}

	CCDictionary * atlasDictionary = (CCDictionary *)textureAtlasNode->objectAtIndex(0);
	float atlasScale = atlasScaleFromAtlasConfig(atlasDictionary);
	for (int i = 1; i < textureAtlasNode->count(); ++i)
	{
		CCDictionary * a = (CCDictionary *)textureAtlasNode->objectAtIndex(i);
		float as = atlasScaleFromAtlasConfig(a);
		if ( fabs(atlasScale - _currentDeviceScale) > fabs(as - _currentDeviceScale))
		{
			atlasDictionary = a;
			atlasScale = as;
		}
	}
	
	_usedAtlasContentScaleFactor = atlasScale;
	CCArray * atlasesInfo = (CCArray *)atlasDictionary->objectForKey(kAtlasInfoKey);
	if (!atlasesInfo)
	{
		GAFLOGERROR("Error while creating GAFAsset.atlasesInfo subnode is missing in atlasDictionary.");
		return false;
	}
	
	_textureAtlas = GAFTextureAtlas::create(fp.c_str(), atlasDictionary);
	if (!_textureAtlas)
	{
		GAFLOGERROR("Failed to initialize GAFAsset. GAFTextureAtlas could not be created.");
		return false;
	}
	CC_SAFE_RETAIN(_textureAtlas);
	
	if (_objects != objectNodes)
	{
		CC_SAFE_RELEASE(_objects);
		_objects = objectNodes;
		CC_SAFE_RETAIN(_objects);
	}
	
	if (_masks != masksNodes)
	{
		CC_SAFE_RELEASE(_masks);
		_masks	  = masksNodes;
		CC_SAFE_RETAIN(_masks);
	}
	
	if (_namedParts != namedPartsNodes)
	{
		CC_SAFE_RELEASE(_namedParts);
		_namedParts	  = namedPartsNodes;
		CC_SAFE_RETAIN(_namedParts);
	}
	
	if (interactionObjectNodes)
	{
		CC_SAFE_RELEASE(_interactionObjects);
		_interactionObjects = CCArray::create();
		CC_SAFE_RETAIN(_interactionObjects);
		
		for (unsigned int i = 0; i < interactionObjectNodes->count(); ++i)
		{
			CCDictionary * dict = (CCDictionary*)interactionObjectNodes->objectAtIndex(i);
			
			GAFInteractionObject * interObject = GAFInteractionObject::create(dict);
			if (interObject)
			{
				_interactionObjects->addObject(interObject);
			}
		}
	}
	
	if (standObjectsNodes)
	{
		CC_SAFE_RELEASE(_standObjects);
		_standObjects = CCArray::create();
		CC_SAFE_RETAIN(_standObjects);
		
		for (unsigned int i = 0; i < standObjectsNodes->count(); ++i)
		{
			CCDictionary * dict = (CCDictionary*)standObjectsNodes->objectAtIndex(i);
			
			GAFActionObject * interObject = GAFActionObject::create(dict);
			if (interObject)
			{
				_standObjects->addObject(interObject);
			}
		}
	}
	
	loadFramesFromConfigDictionary(configDictionary);
	
	if (animationSequences)
	{
		loadAnimationSequences(animationSequences);
	}
	configDictionary->removeAllObjects();
	return true;
}
bool TollgateMapLayer::init() {
    bool bRet = false;

    do {
        CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();

        /* 读取关卡配置 */
        loadConfig();

		/* 加载怪物队列数量 */
		CCString* sMonsterListPath = CCString::createWithFormat("%slevel_%d_others.plist",CCFileUtils::sharedFileUtils()->getWritablePath().c_str(), m_iCurLevel);
	
		if(!CCFileUtils::sharedFileUtils()->isFileExist(sMonsterListPath->getCString()))
		{
			sMonsterListPath = CCString::createWithFormat("tollgate/level_%d_others.plist", m_iCurLevel);
		}
		tinyxml2::XMLDocument * xmlDoc = new tinyxml2::XMLDocument();
		unsigned char* pBuffer = NULL;
		unsigned long bufferSize = 0;

		pBuffer = CCFileUtils::sharedFileUtils()->getFileData(sMonsterListPath->getCString(), "r", &bufferSize);

		if (pBuffer)
		{
			xmlDoc->Parse((const char*)pBuffer);
			CCString* nums = CCString::create(xmlDoc->RootElement()->FirstChildElement()->FirstChildElement()->GetText());
			m_monsterListNum = nums->intValue();
		}
		delete xmlDoc;

		
		/* 创建怪物管理器 */
		m_monsterMgrList = CCArray::createWithCapacity(m_monsterListNum);
		CC_SAFE_RETAIN(m_monsterMgrList);
		for(int i = 0; i < m_monsterListNum; i++){
			m_monsterMgrList->insertObject(MonsterManager::createWithLevel(m_iCurLevel, i), i);
			this->addChild((MonsterManager*)m_monsterMgrList->objectAtIndex(i), MONSTER_LAYER_LVL);
		}
		
		/* 创建英雄管理器 */
		m_heroMgr = HeroManager::createWithLevel(m_iCurLevel);
		this->addChild(m_heroMgr, HERO_LAYER_LVL);

        /* 创建起始点 */
        createStartPoint();

        /* 创建堡垒 */
        createHome();
		
        /* 初始化塔魂、怪物和魔力数量 */
        CCDictionary* dict = CCDictionary::create();

        dict->setObject(CCInteger::create(5), enMsgDataKey_TowerSoulNum);
        NOTIFY->postNotification("TowerSoulChange", dict);

        dict->removeAllObjects();
		CCObject* it = NULL;
		int NotShowMonster = 0;
		CCARRAY_FOREACH(m_monsterMgrList, it){
			MonsterManager* m_monsterMgr = dynamic_cast<MonsterManager*>(it);
			NotShowMonster += m_monsterMgr->getNotShowMonsterCount();
		}
		dict->setObject(CCInteger::create(NotShowMonster), enMsgDataKey_MonsterNum);
        //dict->setObject(CCInteger::create(m_monsterMgr->getNotShowMonsterCount()), enMsgDataKey_MonsterNum);
        NOTIFY->postNotification("MonsterNumChange", dict);

        dict->removeAllObjects();
        dict->setObject(CCInteger::create(100), enMsgDataKey_MagicNum);
        NOTIFY->postNotification("MagicChange", dict);

		dict->removeAllObjects();
        dict->setObject(CCInteger::create(3), enMsgDataKey_MagicNum);
		NOTIFY->postNotification("MonsterListNumChange", dict);

		NOTIFY->addObserver(this, 
			callfuncO_selector(TollgateMapLayer::removeMonsterList), 
			"AllMonsterDead", 
		NULL);

        bRet = true;

    } while (0);